Re: [rspec-users] mimicking a logged in user

2012-03-03 Thread S Ahmed
thanks. but I have to stub the call that hits the database also. how can I wrap this up in a function so I can use it everywhere in my tests where I require a logged in user? where should I put this? in spec_helper? On Sat, Mar 3, 2012 at 5:21 PM, Justin Ko wrote: > > On Mar 3, 2012, at 12:35

Re: [rspec-users] mimicking a logged in user

2012-03-03 Thread Justin Ko
On Mar 3, 2012, at 12:35 PM, S Ahmed wrote: > I'm testing my controller, and confirming that a logged-in user can view the > page. > > I have a session_helper that does this: > > def signed_in? > !current_user.nil? > end > > And the current_user is set with: > > def user_from_remember_to

[rspec-users] mimicking a logged in user

2012-03-03 Thread S Ahmed
I'm testing my controller, and confirming that a logged-in user can view the page. I have a session_helper that does this: def signed_in? !current_user.nil? end And the current_user is set with: def user_from_remember_token remember_token = cookies[:remember_token] User.find_by_reme