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

2008-09-29 Thread David Chelimsky
On Mon, Sep 29, 2008 at 6:35 AM, Juanma Cervera <[EMAIL PROTECTED]> wrote: > Thanks Craig, but I think I don't understand completely. > > "current_user" is a helper method provided by the plugin > restful_authentication > to access the @current_user variable as I understand. > It is defined in lib/

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

2008-09-29 Thread Juanma Cervera
Thanks Craig, but I think I don't understand completely. "current_user" is a helper method provided by the plugin restful_authentication to access the @current_user variable as I understand. It is defined in lib/authenticated_system.rb. We use this helper to access the current logged-in user in t

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

2008-09-29 Thread Craig Demyanovich
I can't tell from your post whether you meant to type an instance or local variable when noting that you "could check the role of the user in the view with current_user.role," since you mentioned an instance variable earlier. assigns[:current_user] = ... sets up an instance variable, @current_user

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

2008-09-29 Thread Juanma Cervera
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 => "w

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

2008-09-29 Thread Juanma Cervera
I have just installed the edge version of rspec and rspec-rails and some of my specs related to views now fail. I use the helper current_user in my views, to access the user that is actually logged in. I was simply using the sentence assigns[:current_user] = stub_model(User,:role => "whatever") a