[rspec-users] Test doubles: expect "x" and don't care about anything else

Wincent Colaiuta win at wincent.com
Mon Jun 29 11:24:39 EDT 2009

El 29/6/2009, a las 17:15, Wincent Colaiuta escribió:

> El 29/6/2009, a las 16:26, Ben Mabey escribió:
>> You probably know this, but for the benefit of others... Pat made a  
>> change a while back that makes it so the stubbed return value will  
>> still be returned even if an expectation is added.  Meaning,  
>> assuming the stub is in the before block, you can change the  
>> expectation to:
>>  Comment.should_receive(:find).with(123)  # this will still return  
>> @comment
> I didn't know that, but it's pretty awesome. Basically means that  
> RSpec mocks can double as proxies now. That's pretty neat.

Er, I stand corrected. I went back looking for the change and found it  
(commit 72facc08), and then I re-read your description. Forget what I  
said about proxying.


More information about the rspec-users mailing list