rSpec, controller, restful route problem

Any thoughts greatly appreciated!

Peace,
Phillip

cause of the error:
no, a singleton resource doesn't need an id, since there is (should be)
only a single thingy of it around (either only one exists at all or like
in case of logins you keep the necessary id in the session)
this nil.to_sym is very typical for that kind of error with the
path_helpers

if for some reason you need the id anyway use:
users_path(:id => user)
but since you store the thing in session[:user_id] that's not necessary

otherwise your spec code looks fine
just i would stub the authenticate thing instead of the id and return a
User out of the fixtures, otherwise you'll end up stubbing every single
attribute for more complex use-cases
(but we're not making that much use of the mock/stub)

Thorsten Mueller wrote:

cause of the error:
no, a singleton resource doesn't need an id, since there is (should be)
only a single thingy of it around (either only one exists at all or like
in case of logins you keep the necessary id in the session)
this nil.to_sym is very typical for that kind of error with the
path_helpers

Thanks for the input, Thorsten. Maybe I'm not understanding the
singleton resource correctly. I was under the impression that if you
have no need of listing out the resources, you should use the singleton.
So in my case, the users controller is for the currently logged in user.
This controller will never list all users (that will be in an admin
controller). Is this the correct understanding? If so, maybe using the
plural form of user was a mistake. If I plan on singleton mapping,
maybe I should use the singular

user_controller

?

Okay, so if I have session[:user_id], I don't need an id passed into
:show, user_path with no parameter would generate the correct route?
Something like

/user/show

?

Wow. If it's really that simple, how'd I miss it? *sigh*

otherwise your spec code looks fine
just i would stub the authenticate thing instead of the id and return a
User out of the fixtures, otherwise you'll end up stubbing every single
attribute for more complex use-cases
(but we're not making that much use of the mock/stub)

The only point of stubbing :id was I thought it was needed by Rails in
users_path(user). I mistakenly thought the error was referring to the
fact that it looked for a method :id and couldn't find it (nil to sym).

Thanks again!
Phillip

This controller will never list all users (that will be in an admin
controller). Is this the correct understanding?

yes

If so, maybe using the
plural form of user was a mistake. If I plan on singleton mapping,
maybe I should use the singular

user_controller

no, your controllers are always pluralized, rails will handle that