Specing dynamic routes


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,
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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs