Understanding routing specs that use constraints

Hello all,

I’m trying to perform a pretty simple routing constraint

Here are my routes, my constraint, and my spec.

As you can see, I’ve attempted to stub my RootConstraints.matches?
method to just return true or false. However, this doesn’t seem to
work correctly. Even when I stub RootConstraints.matches? to return
false, it still always routes root to :controller => “lists”, :action
=> “show”, :id => “name”.

Here is the error that I receive: gist:649432 · GitHub

Can anybody enlighten me as to why this happens?

Thanks,

Joe

On Oct 27, 2010, at 2:49 PM, Joseph DelCioppio wrote:

=> “show”, :id => “name”.

Here is the error that I receive: gist:649432 · GitHub

Can anybody enlighten me as to why this happens?

The issue is within assert_recognizes in Rails (to which route_to
delegates).

See Issues · rspec/rspec-rails · GitHub and
#5805 [PATCH] assert_recognizes does not support constraints - Ruby on Rails - rails
for more info.

HTH,
David