I'm using cucumber
with capybara
I've got several similar errors.
For step:
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
Cucumber error:
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'/'
For step:
Then /I should see an empty table/ do
page.body.scan(/<tr>/).length.should == 0
end
Cucumber error:
undefined method `should' for 1:Fixnum (NoMethodError)
./features/step_definitions/movie_steps.rb:46:in
`/I should see an empty table/'
And for step:
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/'
The whole file of steps is here
As you can see these errors are quite similar but I can't understand what cause this problem.
It looks to me like you are having problems with the rspec-expectations. Try to add
require 'rspec/expectations'
to your env.rb and the equivalent to your Gemfile.
If you're using MiniTest instead of Rspec, try assert
i.e.
assert page.body.scan(/<tr>/).length == 0, "Expected to not find <tr> in page. "
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With