[rspec-users] How to mock a logged in user
robert.dober at gmail.com
Tue Nov 23 10:14:43 EST 2010
On Tue, Nov 23, 2010 at 1:04 PM, Raghu Somaraju <somaraju at gmail.com> 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 answer: Do not do it: Mocking is here to simulate behavior and
ivars are here to implement state. (caching state in our case)
Long answer: Although I believe that the above said is often true
there must be exceptions, I adapted a relish test to show you how it
More information about the rspec-users