class TransitionCollectionWithActionHookWithDifferentActionsTest

Public Instance Methods

save_status() click to toggle source
# File test/unit/transition_collection_test.rb, line 1317
def save_status
  true
end
setup() click to toggle source
# File test/unit/transition_collection_test.rb, line 1313
def setup
  super
  
  @klass.class_eval do
    def save_status
      true
    end
  end
  
  @machine = StateMachine::Machine.new(@klass, :status, :initial => :first_gear, :action => :save_status)
  @machine.state :second_gear
  @machine.event :shift_up
  
  @result = StateMachine::TransitionCollection.new([@transition, StateMachine::Transition.new(@object, @machine, :shift_up, :first_gear, :second_gear)]).perform
end
test_should_have_already_persisted_when_running_action() click to toggle source
# File test/unit/transition_collection_test.rb, line 1337
def test_should_have_already_persisted_when_running_action
  assert_equal 'idling', @object.state_on_save
end
test_should_not_have_event_during_action() click to toggle source
# File test/unit/transition_collection_test.rb, line 1341
def test_should_not_have_event_during_action
  assert_nil @object.state_event_on_save
end
test_should_not_have_event_transition_during_save() click to toggle source
# File test/unit/transition_collection_test.rb, line 1349
def test_should_not_have_event_transition_during_save
  assert_nil @object.state_event_transition_on_save
end
test_should_not_write_event() click to toggle source
# File test/unit/transition_collection_test.rb, line 1345
def test_should_not_write_event
  assert_nil @object.state_event
end
test_should_not_write_event_attribute() click to toggle source
# File test/unit/transition_collection_test.rb, line 1353
def test_should_not_write_event_attribute
  assert_nil @object.send(:state_event_transition)
end
test_should_run_action() click to toggle source
# File test/unit/transition_collection_test.rb, line 1333
def test_should_run_action
  assert @object.saved
end
test_should_succeed() click to toggle source
# File test/unit/transition_collection_test.rb, line 1329
def test_should_succeed
  assert_equal true, @result
end