class PathWithDuplicatesTest

Public Instance Methods

setup() click to toggle source
# File test/unit/path_test.rb, line 143
def setup
  @klass = Class.new
  @machine = StateMachine::Machine.new(@klass)
  @machine.state :parked, :idling
  @machine.event :park, :ignite
  
  @object = @klass.new
  @object.state = 'parked'
  
  @path = StateMachine::Path.new(@object, @machine)
  @path.concat([
    @ignite_transition = StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling),
    @park_transition = StateMachine::Transition.new(@object, @machine, :park, :idling, :parked),
    @ignite_again_transition = StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling)
  ])
end
test_should_not_include_duplicates_in_events() click to toggle source
# File test/unit/path_test.rb, line 168
def test_should_not_include_duplicates_in_events
  assert_equal [:ignite, :park], @path.events
end
test_should_not_include_duplicates_in_from_states() click to toggle source
# File test/unit/path_test.rb, line 160
def test_should_not_include_duplicates_in_from_states
  assert_equal [:parked, :idling], @path.from_states
end
test_should_not_include_duplicates_in_to_states() click to toggle source
# File test/unit/path_test.rb, line 164
def test_should_not_include_duplicates_in_to_states
  assert_equal [:idling, :parked], @path.to_states
end