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

Wincent Colaiuta win at wincent.com
Mon Jun 29 11:15:37 EDT 2009

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.


More information about the rspec-users mailing list