Specing dynamic routes

Hi,

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

http://pastie.org/147021

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

Routes and spec:

http://pastie.org/147018

Error:

‘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