Reputation: 1409
When I set up a new rails 3.1.3 project and write a Cucumber story with Webrat code, like this:
response.should contain("abc")
and I run rake cucumber
, I get:
undefined method `contain' for #<Cucumber::Rails::World:0x00000003d2c578> (NoMethodError)
I believe that either Cucumber or Webrat or Rails is broken because I did nothing special at all and stuck to documentation.
The following steps reproduce the error:
rvm 1.9.2
rails new testapp -d mysql
cd testapp
rake db:create
rake db:migrate
gem install cucumber-rails
gem install webrat
gem install database_cleaner
bundle install
rails g cucumber:install
rails g controller genres index
Feature: Create movie
Description
Scenario: Create a movie in genre
Given a genre named Comedy
When I create a movie Caddyshack in the Comedy genre
Then Caddyshack should be in the Comedy genre
Given /^a genre named Comedy$/ do
end
When /^I create a movie Caddyshack in the Comedy genre$/ do
end
Then /^Caddyshack should be in the Comedy genre$/ do
visit genres_path
response.should contain("abc")
end
rake cucumber
rails 3.1.3
cucumber 1.1.4
cucumber-rails 1.2.1
webrat 0.7.3
rack 1.3.5
rake 0.9.2.2
Any hints about how to resolve this?
Upvotes: 2
Views: 1328
Reputation: 5941
Now by default Cucumber use Capybary instead of Webrat .
You need use have_content instead.
Correct snippet below:
When /^I create a movie Caddyshack in the Comedy genre$/ do
end
Then /^Caddyshack should be in the Comedy genre$/ do
visit genres_path
response.should have_content("abc")
end
Upvotes: 2
Reputation: 1409
I just received a response from the Cucumber (cukes) Google group:
Cucumber-Rails dropped support for Webrat in v0.5.0.beta1 (See https://github.com/cucumber/cucumber-rails/blob/master/History.md)
Use Capybara instead.
Upvotes: 0