class Object

Public Instance Methods

assert_from_present() click to toggle source

Validate the :from state is present

# File lib/state_gate/rspec/allow_transitions_on.rb, line 204
def assert_from_present
  return true unless @state.blank?

  @error = :no_from
  false
end
assert_state_gate(source_obj) click to toggle source

Validate the state machines container exists

# File lib/state_gate/rspec/allow_transitions_on.rb, line 181
def assert_state_gate(source_obj)
  return true if source_obj.respond_to?(:stateables)

  @error = :no_state_gates
  false
end
assert_to_present() click to toggle source

Validate the transitions have been supplied

# File lib/state_gate/rspec/allow_transitions_on.rb, line 226
def assert_to_present
  return true if @to_called

  @error = :no_to
  false
end
assert_valid_key(source_obj) click to toggle source

Validate the state machine is there

# File lib/state_gate/rspec/allow_transitions_on.rb, line 192
def assert_valid_key(source_obj)
  @eng = source_obj.stateables[@key]
  return true unless @eng.blank?

  @error = :invalid_key
  false
end
assert_valid_state() click to toggle source

Validate it is a valid state supplied

# File lib/state_gate/rspec/allow_transitions_on.rb, line 215
def assert_valid_state
  return true if @eng.states.include?(@state)

  @error = :invalid_state
  false
end
assert_valid_transition() click to toggle source

Validate the supplied transitions are valid

# File lib/state_gate/rspec/allow_transitions_on.rb, line 237
def assert_valid_transition
  return true unless invalid_transition_states?

  @error = :invalid_transition_states
  false
end