2012-10-25 62 views
3

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(格式錯誤)

+0

https://gist.github.com/3954397 – JohnHanks

+0

'movie_steps.rb'中的「第22行」在哪裏? – nzifnab

+0

這是內部(:id =>'ratings_form')做 – JohnHanks

回答

1

試着改變你的within閱讀:within('#ratings_form'),看看有沒有改變任何東西......

+0

我得到相同的錯誤 – JohnHanks

+0

OOPS!我拿出了:id – JohnHanks

+0

髖關節hooray它的作品! – JohnHanks

相關問題