in new rails 3.2 app (using either MRI 1.9.2 or 1.9.3) tests are failing with the error:
undefined method `visit' for #RSpec::Core::ExampleGroup::Nested_1:0x00000003e05580
(visit is a capybara method that loads a page, like webrat's get)
capybara gets this method included in the rspec framework by this line in spec_helper:
this in turn runs a block like :
RSpec.configure do |config|
this is not working to include the Capybara dsl methods.
An ugly workaround fixes the problem:
insert the following lines into spec_helper.rb
Why did you close this?
It is because the problem lies with my directory naming. tl;dr you need to name the integration test directory 'requests' (plural). I had been naming it request.
Capybara calls config.include Capybara::DSL, :type => :request
the :request symbol causes rspec to only include if the directory is named requests
it would be cool if it accepted both, but really that doesn' matter. if a person is ignorant of this arrangement they will still not be able to get capy working. There needs to be a neon sign for users to tell them that the name of the directory is critical. I don't know whether that's rspec's responsibility or capybara's, or google's.
thanks for all your work on rspec. it's good software.
From: David Chelimsky firstname.lastname@example.org
To: David Heitzman email@example.com
Sent: Thursday, February 9, 2012 1:07 PM
Subject: Re: [rspec-rails] RSpec.configure not including capybara dsl in spec_helper.rb (#503)
Reply to this email directly or view it on GitHub: