Routes not recognized in RSpec 2/Rails 3.1.4

94 views
Skip to first unread message

Will Marshall

unread,
Apr 25, 2012, 11:59:23 PM4/25/12
to rspec
Hey guys,

I'm having a very tricky issue with the route matching in RSpec 2
(2.9.0)

I recently renamed a "resources" a route using ":path =>". My tests,
which were working before this change, are no longer able to recognize
the renamed route.

I've prepared a test-case illustrating the problem here:
https://gist.github.com/2495632

In a nutshell, I *always* get "No route matches
{:controller=>"health_quotes"}" even though A: I can access
health_quotes_url from within the spec, and B: I can do
Rails.application.routes.recognize_path("/health-insurance", :method
=> :get) and get valid routes.

All the routes work as expected when I run Webrick, and on the staging
server.

Does anyone have a clue what's going on here? Am I missing something
obvious, or is RSpec's route matching borked?

Thanks!
-W

David Chelimsky

unread,
Apr 26, 2012, 6:06:07 AM4/26/12
to rs...@googlegroups.com
There is no "RSpec's route matching" - the `get` method comes from the Rails test framework which rspec-rails exposes but generally doesn't intercept (there are exceptions, but not related to `get`). Try doing the same in a Rails' functional test and let us know if you see any different behavior.

Cheers,
David
Reply all
Reply to author
Forward
0 new messages