I keep wanting to do this, and I don’t think it’s possible so I
thought I’d suggest it. Similarly to the way I can specify stub values
as hash key/value pairs when constructing a test double, I’d like to
be able to the same when subsequently calling stub on that double:
It’s an easy way to do a Fake
(Fake Object at XUnitPatterns.com), at the method level
(all of those patterns are really method level patters, not object
level patterns).
Another use is for expectations:
foo.should_receive(:bar) do |a, b|
a.should be_x
b.should be_y
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.