class TransitionCollectionWithActionHookMultipleTest
Public Instance Methods
save()
click to toggle source
Calls superclass method
TransitionCollectionWithActionHookBaseTest#save
# File test/unit/transition_collection_test.rb, line 1412 def save @saved = true @state_on_save = state @state_event_on_save = state_event @state_event_transition_on_save = state_event_transition @status_on_save = status @status_event_on_save = status_event @status_event_transition_on_save = status_event_transition super 1 end
setup()
click to toggle source
Calls superclass method
TransitionCollectionWithActionHookBaseTest#setup
# File test/unit/transition_collection_test.rb, line 1402 def setup super @status_machine = StateMachine::Machine.new(@klass, :status, :initial => :first_gear, :action => :save) @status_machine.state :second_gear @status_machine.event :shift_up @klass.class_eval do attr_reader :status_on_save, :status_event_on_save, :status_event_transition_on_save def save @saved = true @state_on_save = state @state_event_on_save = state_event @state_event_transition_on_save = state_event_transition @status_on_save = status @status_event_on_save = status_event @status_event_transition_on_save = status_event_transition super 1 end end @object = @klass.new @state_transition = StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling) @status_transition = StateMachine::Transition.new(@object, @status_machine, :shift_up, :first_gear, :second_gear) @result = StateMachine::TransitionCollection.new([@state_transition, @status_transition]).perform end
test_should_have_event_transitions_during_action()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1460 def test_should_have_event_transitions_during_action assert_equal @state_transition, @object.state_event_transition_on_save assert_equal @status_transition, @object.status_event_transition_on_save end
test_should_mark_event_transitions_as_transient()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1470 def test_should_mark_event_transitions_as_transient assert @state_transition.transient? assert @status_transition.transient? end
test_should_not_have_already_persisted_when_running_action()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1440 def test_should_not_have_already_persisted_when_running_action assert_equal 'parked', @object.state_on_save assert_equal 'first_gear', @object.status_on_save end
test_should_not_have_events_during_action()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1450 def test_should_not_have_events_during_action assert_nil @object.state_event_on_save assert_nil @object.status_event_on_save end
test_should_not_write_event_transitions()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1465 def test_should_not_write_event_transitions assert_nil @object.send(:state_event_transition) assert_nil @object.send(:status_event_transition) end
test_should_not_write_events()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1455 def test_should_not_write_events assert_nil @object.state_event assert_nil @object.status_event end
test_should_persist()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1445 def test_should_persist assert_equal 'idling', @object.state assert_equal 'second_gear', @object.status end
test_should_run_action()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1436 def test_should_run_action assert @object.saved end
test_should_succeed()
click to toggle source
# File test/unit/transition_collection_test.rb, line 1432 def test_should_succeed assert_equal 1, @result end