Re: [rspec-users] How to test the assignment of current_user

2010-06-08 Thread Marcelo de Moraes Serpa
Thanks Vinícius ;) 2010/6/7 Vinícius Baggio Fuentes > Oh yes, forgot to add that, if you do self.current_user = user, it will > call your mock as expected. > > Sorry for the multitude of emails. > > > 2010/6/7 Vinícius Baggio Fuentes > > If current_user is an instance variable (as if you did at

Re: [rspec-users] How to test the assignment of current_user

2010-06-07 Thread Vinícius Baggio Fuentes
Oh yes, forgot to add that, if you do self.current_user = user, it will call your mock as expected. Sorry for the multitude of emails. 2010/6/7 Vinícius Baggio Fuentes > If current_user is an instance variable (as if you did attr_accessor > :current_user), you should try: > @current_user = @us

Re: [rspec-users] How to test the assignment of current_user

2010-06-07 Thread Vinícius Baggio Fuentes
If current_user is an instance variable (as if you did attr_accessor :current_user), you should try: @current_user = @user If not, you should try invoking with self: self.current_user = @user because ruby is creating a local variable named current_user instead of invoking #current_user=. When you

[rspec-users] How to test the assignment of current_user

2010-06-07 Thread Marcelo de Moraes Serpa
Hello, This could be rephrased as -- How to test calls of special assigment (setter) methods? I am trying to test the assigmnet of a user object to the current_user=(new_user) method. It is part of an authentication process and finally the object is assigned to the session through this method. I