This is a pure syntactical question. I'm very new to RSpec.
I basically want to write something on the lines of this erroring line :
controller.stub!(:current_user(:update_attributes => false))
Anyone know how to properly write that?
RSpec's default looks like this :
User.stub(:find) { mock_user(:update_attributes => false) }
This looks like a case for stub_chain
:
controller.stub_chain(:current_user,:update_attributes).and_return(false)
Note that this is just going to replace methods in the list in the order they occur, so for this to make sense you'll have a current_user.update_attributes
in your controller. If you have something like @user.update_attributes
, I don't think it will work.
More info on APIDock
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With