class AttributeTransitionCollectionWithSkippedAfterCallbacksTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1873 def setup @klass = Class.new @state = StateMachine::Machine.new(@klass, :initial => :parked, :action => :save) @state.state :idling @state.event :ignite @status = StateMachine::Machine.new(@klass, :status, :initial => :first_gear, :action => :save) @status.state :second_gear @status.event :shift_up @object = @klass.new @object.state_event = 'ignite' @object.status_event = 'shift_up' @transitions = StateMachine::AttributeTransitionCollection.new([ @state_transition = StateMachine::Transition.new(@object, @state, :ignite, :parked, :idling), @status_transition = StateMachine::Transition.new(@object, @status, :shift_up, :first_gear, :second_gear) ], :after => false) end
test_should_clear_events()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1894 def test_should_clear_events @transitions.perform assert_nil @object.state_event assert_nil @object.status_event end
test_should_not_write_event_transitions_if_failed()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1906 def test_should_not_write_event_transitions_if_failed @transitions.perform { false } assert_nil @object.send(:state_event_transition) assert_nil @object.send(:status_event_transition) end
test_should_write_event_transitions_if_success()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1900 def test_should_write_event_transitions_if_success @transitions.perform { true } assert_equal @state_transition, @object.send(:state_event_transition) assert_equal @status_transition, @object.send(:status_event_transition) end