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(格式錯誤)
https://gist.github.com/3954397 – JohnHanks
'movie_steps.rb'中的「第22行」在哪裏? – nzifnab
這是內部(:id =>'ratings_form')做 – JohnHanks