Displaying 2 results from an estimated 2 matches for "with_someth".
2007 Apr 11
0
Fwd: [ mocha-Bugs-8687 ] Block''s return value is dropped on stubbed yielding methods.
...Resolution: None
Priority: 3
Submitted By: Erik Hetzner (egh)
Assigned to: Nobody (None)
Summary: Block''s return value is dropped on stubbed yielding methods.
Initial Comment:
Best explained with an example:
test:
foo = mock()
bar = mock().stubs(:get_baz).returns(:baz)
foo.stubs(:with_something).yields(bar)
real code:
baz = foo.with_something do |bar|
bar.get_baz.to_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 reall...
2007 Feb 16
0
[#8687] Block''s return value is dropped on stubbed yielding methods.
Erik Hetzner has submitted a bug with a suggested patch...
> Best explained with an example:
>
> test:
>
> foo = mock()
> bar = mock().stubs(:get_baz).returns(:baz)
> foo.stubs(:with_something).yields(bar)
>
> real code:
>
> baz = foo.with_something do |bar|
> bar.get_baz.to_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 t...