[rspec-users] Okay, new question - dealing w/ logging in restrictions (controller?)

Fischer, Daniel daniel at danielfischer.com
Thu May 31 22:06:32 EDT 2007

Hey all, so if you read my previous thing about nested routes - I'm
just not going to do with them anymore.

Anyway, so my controller has a before_filter on the edit action; which
checks to see if the current post's user, is the same as the currently
logged in user, if true then they can edit, otherwise not.

  def check_user
    if current_user.login != @post.user.login
      redirect_to post_url(@post)

Now I can easily test this functionality by seeing if I get redirected
if I hit that page, but what if I actually want to be logged in, so I
can test to see if the edit action is working?

Any input on this?


-Daniel Fischer

http://danielfischer.com - Geek Blog
http://abigfisch.com - Portfolio
http://writersbeat.com - Writing Community

More information about the rspec-users mailing list