undefined method `visit’ for RSpec with Capybara

I just started to write an acceptance test with capybara. I followed the code example on the GitHub Page and I got this odd error:

Failure/Error: visit 'http://127.0.0.1:3000/signin'
 NoMethodError:
 undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fda48e0f680>

I placed my test in “spec/requests”. After some research I found out that the new Capybara GEM expects the test to be in “spec/features”. After I moved my test file to the right directory it worked perfectly.

Published by Robert Reiz

CEO @ VersionEye. Passionated software developer since 1998.

2 thoughts on “undefined method `visit’ for RSpec with Capybara

  1. God bless you — I’m taking baby steps trying to learn Ruby/Rails, and this was driving me crazy. Following your recommendation to put the test in a different directory works like a charm for me.

    I’m using:
    Rails 4.0.2
    capybara-2.2.1
    rspec-rails-2.14.1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: