Re: [rspec-users] Suggested shorthand for and_return when stubbing

2010-02-20 Thread Matt Wynne
On 20 Feb 2010, at 23:22, David Chelimsky wrote: On Sat, Feb 20, 2010 at 4:09 PM, Matt Wynne wrote: 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 doubl

Re: [rspec-users] Suggested shorthand for and_return when stubbing

2010-02-20 Thread David Chelimsky
On Sat, Feb 20, 2010 at 5:27 PM, Frank Lakatos wrote: >  me.stub(:sum) {|a,b| a + b} = really slick trick! It's an easy way to do a Fake (http://xunitpatterns.com/Fake%20Object.html), at the method level (all of those patterns are really method level patters, not object level patterns). Another

Re: [rspec-users] Suggested shorthand for and_return when stubbing

2010-02-20 Thread Frank Lakatos
me.stub(:sum) {|a,b| a + b} = really slick trick! On Feb 20, 2010, at 6:22 PM, David Chelimsky wrote: On Sat, Feb 20, 2010 at 4:09 PM, Matt Wynne wrote: 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 a

Re: [rspec-users] Suggested shorthand for and_return when stubbing

2010-02-20 Thread David Chelimsky
On Sat, Feb 20, 2010 at 4:09 PM, Matt Wynne wrote: > 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 > subsequent

[rspec-users] Suggested shorthand for and_return when stubbing

2010-02-20 Thread Matt Wynne
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: me.stub(:name =>