[mocha-developer] Beyond multiple return values
James Moore
jamesthepiper at gmail.com
Mon Mar 5 16:27:22 EST 2007
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
Adding raises() to TestObject seems a bit intrusive.
- James Moore
More information about the mocha-developer
mailing list