class AttributeTransitionCollectionWithCallbacksTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1687 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 @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) ]) end
test_should_not_have_event_transitions_during_action()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1736 def test_should_not_have_event_transitions_during_action @transitions.perform { @state_event_transition = @object.send(:state_event_transition) } assert_nil @state_event_transition end
test_should_not_have_event_transitions_during_after_callbacks()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1742 def test_should_not_have_event_transitions_during_after_callbacks @state.after_transition {|object, transition| @after_state_event_transition = object.send(:state_event_transition) } @state.around_transition {|object, transition, block| block.call; @around_state_event_transition = object.send(:state_event_transition) } @transitions.perform assert_nil @after_state_event_transition assert_nil @around_state_event_transition end
test_should_not_have_event_transitions_during_before_callbacks()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1729 def test_should_not_have_event_transitions_during_before_callbacks @state.before_transition {|object, transition| @state_event_transition = object.send(:state_event_transition) } @transitions.perform assert_nil @state_event_transition end
test_should_not_have_events_during_action()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1715 def test_should_not_have_events_during_action @transitions.perform { @state_event = @object.state_event } assert_nil @state_event end
test_should_not_have_events_during_after_callbacks()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1721 def test_should_not_have_events_during_after_callbacks @state.after_transition {|object, transition| @after_state_event = object.state_event } @state.around_transition {|object, transition, block| block.call; @around_state_event = object.state_event } @transitions.perform assert_nil @state_event end
test_should_not_have_events_during_before_callbacks()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1706 def test_should_not_have_events_during_before_callbacks @state.before_transition {|object, transition| @before_state_event = object.state_event } @state.around_transition {|object, transition, block| @around_state_event = object.state_event; block.call } @transitions.perform assert_nil @before_state_event assert_nil @around_state_event end