[mocha-developer] Beyond multiple return values
James Mead
jamesmead44 at gmail.com
Fri Mar 9 04:48:29 EST 2007
On 05/03/07, James Moore <jamesthepiper at gmail.com> wrote:
>
> How about saying that if what is passed to returns() is an exception, or a
> class that's a descendant of Exception, it's raised instead of returned?
> You could still return an exception by returning it from a lambda.
>
> obj.stubs(:save!).returns(RuntimeError.new("testing..."), true) # Raises,
> true
> obj.stubs(:save!).returns(RuntimeError, true) # Raises, true
> obj.stubs(:save!).returns(lambda {RuntimeError}, true) # returns the
> exception object, true
I'm not sure it's so clear what's going to happen in the above cases.
Adding raises() to TestObject seems a bit intrusive.
>
In what way do you think it would be intrusive?
--
James.
http://blog.floehopper.org
More information about the mocha-developer
mailing list