2017-03-29 10 views
0

RoRのActiveRecordオブジェクト/リストのeachを次のコードのように呼び出しようとしています。サポートされていません:Cucumber on Railsのシンボル

41 Then /I should (not)?see movies with ratings: (.*)/ do |not_see, rating_li> 
42 @movies = Movie.where(:rating, rating_list.split(", ")) 
43 rating_list.split(",").map do |x| 
44  x.strip 
45 end.each do |rating| 
46  if not_see 
47  @movies.each do |movie| 
48   @movie.title 
49  end 
50  else 
51  puts "hello" 
52  end 
53 end 
54 end 

そしてこれは、次のエラーメッセージが表示されます。コードの行47を削除

And I should not see movies with ratings: G, PG-13, NC-17 # features/step_definitions/movie_steps.rb:41 
    unsupported: Symbol (RuntimeError) 
    ./features/step_definitions/movie_steps.rb:47:in `block (2 levels) in <top (required)>' 
    ./features/step_definitions/movie_steps.rb:45:in `each' 
    ./features/step_definitions/movie_steps.rb:45:in `/I should (not)?see movies with ratings: (.*)/' 
    features/filter_movie_list.feature:33:in `And I should not see movies with ratings: G, PG-13, NC-17' 

は、上記のエラーを取り除きます。何故ですか?私が知る限り、これらはすべて有効なRubyコードです。私は何が欠けていますか?

ありがとうございました!

答えて

0

エラーの原因となったコード行は、行42です。 whereへの呼び出しがされている必要があります:

Movie.where(:rating => rating_list.split(",")) 

"=>"なく","

関連する問題