[rspec-users] Understanding how to better use stub! and stub_chain

Joseph DelCioppio joseph.delcioppio at gmail.com
Mon May 31 15:35:31 EDT 2010


I've been looking through the RSpec source to better understand how
RSpec works and I've got a question about the functionality of stub!.
I noticed that you can pass a symbol to stub!, which is usually how I
use it, some combination of stub!(:method).with(inputs).

However, I'm noticing that you can also pass opts and a &block if you
wanted to?

Can somebody give me an example of this, or why you'd want to do this?

Thanks,

Joe


More information about the rspec-users mailing list