[rspec-users] how to stub the :current_user and any methods associated with it

Jarkko Laine jarkko at jlaine.net
Sun Apr 13 13:03:29 EDT 2008

On 12.4.2008, at 22.24, newbie wrote:

> Hey Jarkko,
> Thanks for the feedback. I tried your suggestion and it doesn't seem
> to work.

What doesn't work?

> To quickly recap I'm just testing in my controller that this works
> def index
> @entries = current_user.entries
> end
> describe "on the main page" do
> it "should show all the current entries for the user" do
>    get :index
>    assigns[:entries].should == @entries
> end

I don't see you logging in a user anywhere.


Jarkko Laine

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/rspec-users/attachments/20080413/c5ab6e24/attachment.bin 

More information about the rspec-users mailing list