class TransitionAfterBeingRolledBackTest

Public Instance Methods

setup() click to toggle source
# File test/unit/transition_test.rb, line 344
def setup
  @klass = Class.new
  @machine = StateMachine::Machine.new(@klass, :action => :save)
  @machine.state :parked, :idling
  @machine.event :ignite
  
  @object = @klass.new
  @object.state = 'parked'
  
  @transition = StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling)
  @object.state = 'idling'
  
  @transition.rollback
end
test_should_not_change_from_state() click to toggle source
# File test/unit/transition_test.rb, line 363
def test_should_not_change_from_state
  assert_equal 'parked', @transition.from
end
test_should_not_change_to_state() click to toggle source
# File test/unit/transition_test.rb, line 367
def test_should_not_change_to_state
  assert_equal 'idling', @transition.to
end
test_should_still_be_able_to_persist() click to toggle source
# File test/unit/transition_test.rb, line 371
def test_should_still_be_able_to_persist
  @transition.persist
  assert_equal 'idling', @object.state
end
test_should_update_state_value_to_from_state() click to toggle source
# File test/unit/transition_test.rb, line 359
def test_should_update_state_value_to_from_state
  assert_equal 'parked', @object.state
end