You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
require 'capybara/rspec'
this in turn runs a block like :
RSpec.configure do |config|
..
end
this is not working to include the Capybara dsl methods.
An ugly workaround fixes the problem:
insert the following lines into spec_helper.rb
module ::RSpec::Core
class ExampleGroup
include Capybara::DSL
include Capybara::RSpecMatchers
end
end
The text was updated successfully, but these errors were encountered:
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.
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.
David Heitzman
From: David Chelimsky reply@reply.github.com
To: David Heitzman daveheitzman@yahoo.com
Sent: Thursday, February 9, 2012 1:07 PM
Subject: Re: [rspec-rails] RSpec.configure not including capybara dsl in spec_helper.rb (#503)
Why did you close this?
Reply to this email directly or view it on GitHub: #503 (comment)
rspec-rails: 2.8.1
capybara: 1.1.2
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:
require 'capybara/rspec'
this in turn runs a block like :
RSpec.configure do |config|
..
end
this is not working to include the Capybara dsl methods.
An ugly workaround fixes the problem:
insert the following lines into spec_helper.rb
module ::RSpec::Core
class ExampleGroup
include Capybara::DSL
include Capybara::RSpecMatchers
end
end
The text was updated successfully, but these errors were encountered: