class Mocha::Expectation
def throws(tag, object = nil)
- Example: Throw tag on first invocation of expected method and then return values for subsequent invocations. -
Example: Throw different tags on consecutive invocations of the expected method. -
Example: Throw tag with return value +object+ c.f. +Kernel#throw+. -
Example: Throw tag when expected method is invoked. -
Overloads:
-
def throw(tag, object) -
def throw(tag)
Other tags:
- See: #then -
See: Kernel#throw -
Returns:
-
(Expectation)- the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
Parameters:
-
object(Object) -- return value for the catch block. -
tag(Symbol, String) -- tag to throw to transfer control to the active catch block.
def throws(tag, object = nil) @return_values += ReturnValues.new(Thrower.new(tag, object)) self end