class PathCollectionWithDeepPathsTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/path_collection_test.rb, line 227 def setup @klass = Class.new @machine = StateMachine::Machine.new(@klass) @machine.state :parked, :idling @machine.event :ignite do transition :parked => :idling end @machine.event :shift_up do transition :parked => :idling, :idling => :first_gear end @machine.event :shift_down do transition :first_gear => :idling end @object = @klass.new @object.state = 'parked' @paths = StateMachine::PathCollection.new(@object, @machine, :to => :idling, :deep => true) end
test_should_allow_target_to_be_reached_more_than_once_per_path()
click to toggle source
# File test/unit/path_collection_test.rb, line 246 def test_should_allow_target_to_be_reached_more_than_once_per_path assert_equal [ [ StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling) ], [ StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling), StateMachine::Transition.new(@object, @machine, :shift_up, :idling, :first_gear), StateMachine::Transition.new(@object, @machine, :shift_down, :first_gear, :idling) ], [ StateMachine::Transition.new(@object, @machine, :shift_up, :parked, :idling) ], [ StateMachine::Transition.new(@object, @machine, :shift_up, :parked, :idling), StateMachine::Transition.new(@object, @machine, :shift_up, :idling, :first_gear), StateMachine::Transition.new(@object, @machine, :shift_down, :first_gear, :idling) ] ], @paths end