Cucumber: не може да конвертира нула в низ TypeError

filter_movie_list.feature

When I check the following ratings: PG, R

movie_steps.rb

When /^I check the following ratings: (.*)/ do |rating_list|
  within(:id => 'ratings_form') do
    rating_list.split(', ').each do |rating|
      check("ratings_#{rating}")
    end
  end
end

index.html.haml

= form_tag movies_path, :method => :get, :id => 'ratings_form' do
  = hidden_field_tag "title_sort", true if @title_header
  = hidden_field_tag ":release_date_sort", true if @date_header
  Include: 
  - @all_ratings.each do |rating|
    = rating
    = check_box_tag "ratings[#{rating}]", 1, @selected_ratings.include?(rating), :id => "ratings_#{rating}"
  = submit_tag 'Refresh', :id => 'ratings_submit'

Получавам тази грешка:

When I check the following ratings: PG, R          #step_definitions/movie_steps.rb:21
  can't convert nil into String (TypeError)
  (eval):2:in `find'
  ./step_definitions/movie_steps.rb:22:in `/^I check the following ratings: (.*)/'
  filter_movie_list.feature:26:in `When I check the following ratings: PG, R'

Какво да правя?

РЕДАКТИРАНЕ: Съжалявам за n00bishness (грешки във форматирането)


person JohnHanks    schedule 25.10.2012    source източник
comment
gist.github.com/3954397   -  person JohnHanks    schedule 25.10.2012
comment
Къде е ред 22 в movie_steps.rb?   -  person nzifnab    schedule 25.10.2012
comment
това е рамките на(:id =› 'ratings_form').   -  person JohnHanks    schedule 25.10.2012


Отговори (1)


Опитайте да промените своя within да чете: within('#ratings_form') и вижте дали това променя нещо...

person nzifnab    schedule 25.10.2012
comment
да :D Доколкото знам within() приема само css селектори. Не съм виждал никаква документация, подкрепяща този хеш на :id => опциите, който изпращахте. Радвам се, че беше проста корекция :) - person nzifnab; 26.10.2012