class EventWithTransitionsTest

Public Instance Methods

setup() click to toggle source
# File test/unit/event_test.rb, line 458
def setup
  @klass = Class.new
  @machine = StateMachine::Machine.new(@klass)
  @machine.events << @event = StateMachine::Event.new(@machine, :ignite)
  @event.transition(:parked => :idling)
  @event.transition(:first_gear => :idling)
end
test_should_include_all_transition_states_in_known_states() click to toggle source
# File test/unit/event_test.rb, line 466
def test_should_include_all_transition_states_in_known_states
  assert_equal [:parked, :idling, :first_gear], @event.known_states
end
test_should_include_new_transition_states_after_calling_known_states() click to toggle source
# File test/unit/event_test.rb, line 470
def test_should_include_new_transition_states_after_calling_known_states
  @event.known_states
  @event.transition(:stalled => :idling)
  
  assert_equal [:parked, :idling, :first_gear, :stalled], @event.known_states
end
test_should_use_pretty_inspect() click to toggle source
# File test/unit/event_test.rb, line 477
def test_should_use_pretty_inspect
  assert_match "#<StateMachine::Event name=:ignite transitions=[:parked => :idling, :first_gear => :idling]>", @event.inspect
end