Displaying 2 results from an estimated 2 matches for "expecatation".
Did you mean:
expecation
2007 Feb 16
0
[#8687] Block''s return value is dropped on stubbed yielding methods.
...az should now be "baz", but is nil because we have not specified a return value for the stub. Now, we could
> set add .returns("baz"), but that means that the block isn''t really tested.
>
> I have attached a file patches on a yields_and_returns method to Mocha::Expecatation & Mocha::Stub which will return
> the block''s return value.
>
> foo = Mocha::Mock.new
> bar = Mocha::Mock.new
> bar.stubs(:get_baz).returns(:baz)
> foo.stubs(:with_something).yields_and_returns(bar)
>
> baz = foo.with_something do |bar|
> bar.get_baz.to_s
&...
2007 Apr 11
0
Fwd: [ mocha-Bugs-8687 ] Block''s return value is dropped on stubbed yielding methods.
..._s
end
baz should now be "baz", but is nil because we have not specified a return
value for the stub. Now, we could set add .returns("baz"), but that means
that the block isn''t really tested.
I have attached a file patches on a yields_and_returns method to
Mocha::Expecatation & Mocha::Stub which will return the block''s return
value.
foo = Mocha::Mock.new
bar = Mocha::Mock.new
bar.stubs(:get_baz).returns(:baz)
foo.stubs(:with_something).yields_and_returns(bar)
baz = foo.with_something do |bar|
bar.get_baz.to_s
end
----------------------------...