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 have tried: controller.should_receive(:current_user=).with(@user) post :create, @params And the output is: expected :current_user= with (#<User id: 605 <.... snip ...> ) once, but received it 0 times I do not understand, since current_user=(new_user) is actually being called by the controller: def create <snip> current_user = @user <snip> end Why's that? Thanks, Marcelo.
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users