[rspec-users] specing dynamic routes

Tye Shavik tyeshavik at gmail.com
Sun Feb 3 16:12:35 EST 2008


I dynamically generating routes and I'm running into trouble specing
due to isolation.
I need to know if there is a way to mock routes, I tried but not sure
how to approach it.

Let me describe what I'm attempting to do:

I have many nodes of different category types eg. polls, pictures, videos
So whenever a new category is added there should be named routes for it.

The code part works fine, the routes are being generated


But I don't know how to make rspec play pretend and say the routes are there.

Routes and spec:



'NodesController#route_for should map { :controller => 'nodes',
:action => 'index' } to /discussions' FAILED
expected: "/discussions",
     got: "/nodes?node_category=discussions" (using ==)

Thanks for any assistance

More information about the rspec-users mailing list