It seems to be a little strange, as if it misses something in setup
instructions for spec-rails and capybara.
I tried to use the following 2 versions (here is an extract from the RoR
Gemfile):
group :development, :test do
gem "rspec-rails", "~> 2.13.0"
end
group :test do
gem 'capybara', '~> 2.0.2'
gem 'database_cleaner', '~> 0.9.1'
gem 'launchy', '~> 2.2.0'
end
As advised at Capybara site, I added the following 2 lines to
spec_helper.rb file:
If you are using Rails, add this line to your test helper file:
*require 'capybara/rails'*
Load RSpec 2.x support by adding the following line (typically to your
spec_helper.rb file):
*require 'capybara/rspec'*
Then, as it is said at Capybara:
If you are using Rails, put your Capybara specs in spec/features.
So if I put the specs as I had before in my spec/requests folder in
spec/features it works.
But it fails to find Capybara 'visit' method if I leave the spec in
spec/requests folder:
StaticPages
Home page
example at ./spec/requests/static_pages_spec.rb:10 (FAILED - 1)
example at ./spec/requests/static_pages_spec.rb:11 (FAILED - 2)
Failures:
1) StaticPages Home page
Failure/Error: before { visit '/static_pages/home' }
NoMethodError:
undefined method `visit' for
#<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fb4ffc60d70>
# ./spec/requests/static_pages_spec.rb:8:in `block (3 levels) in <top
(required)>'
2) StaticPages Home page
Failure/Error: before { visit '/static_pages/home' }
NoMethodError:
undefined method `visit' for
#<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fb4ff85e100>
# ./spec/requests/static_pages_spec.rb:8:in `block (3 levels) in <top
(required)>'
Finished in 0.01803 seconds
2 examples, 2 failures
Any ideas? So no more possible to have the 'old' RSpec structure with
separate controllers, requests... folders ?
Thanks you.
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msg/rspec/-/E4QxHc0N9I8J.
For more options, visit https://groups.google.com/groups/opt_out.