class StateCollectionWithInitialStateTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/state_collection_test.rb, line 165 def setup @machine = StateMachine::Machine.new(Class.new) @states = StateMachine::StateCollection.new(@machine) @states << @parked = StateMachine::State.new(@machine, :parked) @states << @idling = StateMachine::State.new(@machine, :idling) @machine.states.concat(@states) @parked.initial = true end
speed()
click to toggle source
# File test/unit/state_collection_test.rb, line 185 def speed 0 end
test_should_order_state_before_callback_states()
click to toggle source
# File test/unit/state_collection_test.rb, line 196 def test_should_order_state_before_callback_states @machine.before_transition :from => :idling, :do => lambda {} assert_equal [@parked, @idling], @states.by_priority end
test_should_order_state_before_other_states()
click to toggle source
# File test/unit/state_collection_test.rb, line 192 def test_should_order_state_before_other_states assert_equal [@parked, @idling], @states.by_priority end
test_should_order_state_before_states_with_behaviors()
click to toggle source
# File test/unit/state_collection_test.rb, line 183 def test_should_order_state_before_states_with_behaviors @idling.context do def speed 0 end end assert_equal [@parked, @idling], @states.by_priority end
test_should_order_state_before_transition_states()
click to toggle source
# File test/unit/state_collection_test.rb, line 176 def test_should_order_state_before_transition_states @machine.event :ignite do transition :to => :idling end assert_equal [@parked, @idling], @states.by_priority end