First of all, you should be careful with any call to stub.
You probably want to use stub just to simulate a behavior, one that you don’t want to test in your current test.
For example: You may want to use stub with a remote service, an API call.
Also, the method is stub not stub! (at least in RSpec 2.6.0)
This will not work but will not fail.
DineroMailIpn::Client.any_instance.stub!(
:consulta_pago).and_return(@response_with_pays)
This is what you are looking for.
DineroMailIpn::Client.any_instance.stub(
:consulta_pago).and_return(@response_with_pays)
I don’t know exactly why stub! doesn’t fail, but it wasn’t doing what I was expecting (to actually stub that method and return the mock object I wanted)
