Rspec and named routes
Named routes should work if you put the following in rspec_helper.rb:
RSpec.configure do |config|
config.include Rails.application.routes.url_helpers
...
end
Is that how you set it up?
Google brought me here, even my error message doesn't fit 100%.
In my case Capybara command visit
is unknown...
Error:
NoMethodError:
undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0xa49a73c>
Since Capybara 2.0 one has to use folder spec/features
capybara commands don't work in folder spec/requests
anymore.
That helped me: http://alindeman.github.com/2012/11/11/rspec-rails-and-capybara-2.0-what-you-need-to-know.html
Hope you find this usefull.
I don't think you have access to named routes inside of your rspec controller specs. You could however just do visit('/'), which is the equivalent of root_path.
I had the same problem, with the same Tutorial. It turns out that I needed to just restart the Spork service, and all worked fine.
The solution posted by Tom L worked for me, but when I removed that line and restarted Spork, that also fixed the problem.
Hope that helps out any other people who are wary about deviating from the tutorial's code!