class StateCollectionWithTransitionCallbacksTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/state_collection_test.rb, line 279 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) @machine.before_transition :to => :idling, :do => lambda {} end
speed()
click to toggle source
# File test/unit/state_collection_test.rb, line 304 def speed 0 end
test_should_order_states_after_initial_state()
click to toggle source
# File test/unit/state_collection_test.rb, line 290 def test_should_order_states_after_initial_state @parked.initial = true assert_equal [@parked, @idling], @states.by_priority end
test_should_order_states_after_other_states()
click to toggle source
# File test/unit/state_collection_test.rb, line 311 def test_should_order_states_after_other_states assert_equal [@parked, @idling], @states.by_priority end
test_should_order_states_after_states_with_behaviors()
click to toggle source
# File test/unit/state_collection_test.rb, line 302 def test_should_order_states_after_states_with_behaviors @parked.context do def speed 0 end end assert_equal [@parked, @idling], @states.by_priority end
test_should_order_states_after_transition_states()
click to toggle source
# File test/unit/state_collection_test.rb, line 295 def test_should_order_states_after_transition_states @machine.event :ignite do transition :from => :parked end assert_equal [@parked, @idling], @states.by_priority end