[rspec-users] Problems mocking controller helpers with the last version.

Juanma Cervera lists at ruby-forum.com
Mon Sep 29 07:14:37 EDT 2008


Well, it seems pretty obvious that I can't use "controller" to mock 
controller methods in the view specs, but I was assigning a mock for the 
current logged-in user to the @current_user variable and it worked on 
rspec 1.1.4

I was doing this:

assigns[:current_user] = stub_model(User, :role => "whatever")

and I could check the role of the user in the view with 
current_user.role.

Was it correct or I had to do it in another way?

Thanks
Juanma Cervera

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list