Class: Mocha::StateMachine::StatePredicate

Inherits:
Object
  • Object
show all
Defined in:
lib/mocha/state_machine.rb

Overview

Provides the ability to determine whether a Mocha::StateMachine is in a specified state at some point in the future.

Instance Method Summary collapse

Constructor Details

#initialize(state_machine, state) ⇒ StatePredicate

Returns a new instance of StatePredicate


36
37
38
# File 'lib/mocha/state_machine.rb', line 36

def initialize(state_machine, state)
  @state_machine, @state = state_machine, state
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)

41
42
43
# File 'lib/mocha/state_machine.rb', line 41

def active?
  @state_machine.current_state != @state
end

#mocha_inspectObject


46
47
48
# File 'lib/mocha/state_machine.rb', line 46

def mocha_inspect
  "#{@state_machine.name} is not #{@state.mocha_inspect}"
end