[rspec-users] Mocking Authentication
Michael Trier
mtrier at eminentconsultinggroup.com
Thu Apr 5 23:26:18 EDT 2007
Thanks so much. Funny that you responded because I saw your post
about testing controllers and your mention of
mock_user_authentication, but no implementation for it when I did a
search. I tried to contact you but couldn't find a contact address.
Anyway, thanks so much. I'll give that a shot.
Michael
On Apr 5, 2007, at 11:07 PM, Graeme Nelson wrote:
> Hi Michael -
>
> I tried to reply from my work email and it bounced. oops.
>
> This is what I am doing on a current project:
>
> def mock_user_authentication(allow_user_to_pass=true)
> controller.stub!(:login_required).and_return(allow_user_to_pass)
> end
>
> You get the controller object with your controller specs.
>
> I am sure there are other ways of doing this, but I found this to be
> pretty clean.
>
> Thanks
> Graeme Nelson
>
> On Apr 5, 2007, at 6:30 PM, Michael Trier wrote:
>
>> Is anyone using Restful Authentication? If so, how are you mocking
>> the login for your controllers? I'm having trouble with it and would
>> love an example of someone's login. I'm sure I'm missing something
>> simple.
>>
>> Michael
>> railsconsulting.com
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
More information about the rspec-users
mailing list