我正在cucumber
使用capybara
我有几个类似的错误。
对于步骤:
Then /I should see movies of rating 'PG' or 'R'/ do
page.body.should match(/<td>PG<\/td>/)
page.body.should match(/<td>R<\/td>/)
end
黄瓜错误:
undefined method `match' for #<Cucumber::Rails::World:...> (NoMethodError)
./features/step_definitions/movie_steps.rb:37:in
`/I should see movies of rating 'PG' or 'R'/'
对于步骤:
Then /I should see an empty table/ do
page.body.scan(/<tr>/).length.should == 0
end
黄瓜错误:
undefined method `should' for 1:Fixnum (NoMethodError)
./features/step_definitions/movie_steps.rb:46:in
`/I should see an empty table/'
对于步骤:
Then /I should see all of the movies/ do
Movie.find(:all).length.should page.body.scan(/<tr>/).length
end
undefined method `should' for 10:Fixnum (NoMethodError)
./features/step_definitions/movie_steps.rb:59:in
`/I should see all of the movies/'
整个步骤文件在这里
如您所见,这些错误非常相似,但我不明白是什么导致了这个问题。