[rspec-users] how do I spec my Rails routes?

David Chelimsky dchelimsky at gmail.com
Sun Dec 16 11:43:37 EST 2007

On Dec 16, 2007 10:32 AM, Francis Hwang <sera at fhwang.net> wrote:
> Once again, here's something I haven't figured out. Apologies if this
> is too newb-ish, but, how do I spec my routes using RSpec-Rails?
> In particular, I've got a catch-all route that needs to catch a wide
> variety of URLs:
> map.document '*url', :controller => 'documents', :action => 'show'
> Is there a way to have a controller spec test site-wide routing? It
> seems to me that the get and post methods are just controller-
> specific routing. If I can't do it in a controller spec, where else
> should I do it?

Check out route_for and params_from at http://rspec.info/rdoc-rails/.
There are examples of their use in the controller examples generated
by 'script/generate rspec_scaffold ...'. Here are a couple of



> Thanks,
> Francis Hwang
> http://fhwang.net/
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list