Re: [rspec-users] How to mock a logged in user

2010-11-24 Thread Raghu Somaraju
Robert Dober wrote: > > On Tue, Nov 23, 2010 at 1:04 PM, Raghu Somaraju > wrote: >> >> Thank you Robert. That works. I should have used the "current_user" >> instead >> of @_current_user in the first place. >> >> But, if I do want to use @_current_user, how do I pass on that instance >> variabl

Re: [rspec-users] How to mock a logged in user

2010-11-23 Thread Robert Dober
On Tue, Nov 23, 2010 at 1:04 PM, Raghu Somaraju wrote: > > Thank you Robert. That works. I should have used the "current_user" instead > of @_current_user in the first place. > > But, if I do want to use @_current_user, how do I pass on that instance > variable to the controller from spec? Short

Re: [rspec-users] How to mock a logged in user

2010-11-23 Thread Raghu Somaraju
Thank you Robert. That works. I should have used the "current_user" instead of @_current_user in the first place. But, if I do want to use @_current_user, how do I pass on that instance variable to the controller from spec? Ignore the item_choice. It is a remnant of a piece that I edited off to

Re: [rspec-users] How to mock a logged in user

2010-11-22 Thread Robert Dober
On Mon, Nov 22, 2010 at 1:24 PM, Raghunandan Somaraju wrote: > I need to update something for a logged in user. My controller code for the > action is: > > def som_action > �...@_current_user.save_choice(params) > end you are stubbing current_user, not @_current_user, thus this will fail. Maybe it

[rspec-users] How to mock a logged in user

2010-11-22 Thread Raghunandan Somaraju
I need to update something for a logged in user. My controller code for the action is: def som_action @_current_user.save_choice(params) end My application_controller.rb contains the following: class ApplicationController < ActionController::Base before_filter :current_user def current_