views:

183

answers:

3

Hi there,

When i run my features i get this error:

undefined method `visit' for #<Cucumber::Rails::World:0x81b17ac0> (NoMethodError)

This is the relevant part of my Gemfile.

group :development, :test do
  gem "rspec-rails", ">= 2.0.0.beta.19"
  gem "cucumber"
  gem "cucumber-rails", ">= 0.3.2"
  gem 'webrat', ">= 0.7.2.beta.1"
end

The relating step_definition (though i don't think it's important)

When /^I create a movie Caddyshack in the Comendy genre$/ do
  visit movies_path
  click_link "Add Movie"
  fill_in "Title", :with => "Caddyshack"
  check "Comedy"
  click_button "Save"
end

In the env.rb i have the following Webrat configuration:

# […]
require 'webrat'
require 'webrat/core/matchers'

Webrat.configure do |config|
  config.mode = :rails
  config.open_error_files = false # Set to true if you want error pages to pop up in the browser
end
# […]

Anything i am missing here?

A: 

I had to set config.mode to :rack instead of :rails:

# […]
require 'webrat'
require 'webrat/core/matchers'

Webrat.configure do |config|
  config.mode = :rack
  config.open_error_files = false # Set to true if you want error pages to pop up in the browser
end
# […]

now works as expected.

Nils Riedemann
A: 

Following the example from 'the rspec book' beta I see. I ran into the same problems. With the book, they never mentioned this webrat config within env.rb ... I'm a little frustrated by this.

Anyway, I followed your example here, but now I'm getting another error:

no such file to load -- action_controller/integration (LoadError)

even more frustrating. Ok, I'm going to search. Will report any solution I find. Thanks!

Paul Nelligan
A: 

Paul Nelligan try adding this to env.rb to fix the error : "no such file to load -- action_controller/integration"

World(Webrat::Methods)
World(Webrat::Matchers)
pagetribe