[rspec-devel] [ rspec-Feature Requests-12894 ] Stubs should be able to both return and yield a value

noreply at rubyforge.org noreply at rubyforge.org
Tue Aug 7 20:42:09 EDT 2007


Feature Requests item #12894, was opened at 2007-08-08 00:42
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=12894&group_id=797

Category: None
Group: None
Status: Open
Priority: 3
Submitted By: Scott Taylor (smtlaissezfaire)
Assigned to: Nobody (None)
Summary: Stubs should be able to both return and yield a value

Initial Comment:

Stubs can return values:

obj.stub!(:example_method).and_return "val"

or they could yield to values:

obj.stub!(:example_method).and_yield "val"

What if they could do both?

obj.stub!(:example_method).yield("val").and_return "val"

Better syntax is welcome.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=12894&group_id=797


More information about the rspec-devel mailing list