class Mocha::Expectation

def then(state = nil)

Other tags:
    Example: Using {#then} to change the +state+ of a +state_machine+ on the invocation of an expected method. -
    Example: Using {#then} as syntactic sugar when specifying values to be returned and exceptions to be raised on consecutive invocations of the expected method. -

Returns:
  • (Expectation) - the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.

Other tags:
    See: #when -
    See: StateMachine -
    See: API#states -

Parameters:
  • state (StateMachine::State) -- state_machine.is(state_name) provides a mechanism to change the +state_machine+ into the state specified by +state_name+ when the expected method is invoked.

Overloads:
  • def then(state)
  • def then
def then(state = nil)
  add_side_effect(ChangeStateSideEffect.new(state)) if state
  self
end