class TransitionWithCustomMachineAttributeTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/transition_test.rb, line 225 def setup @klass = Class.new @machine = StateMachine::Machine.new(@klass, :state, :attribute => :state_id) @machine.state :off, :value => 1 @machine.state :active, :value => 2 @machine.event :activate @object = @klass.new @object.state_id = 1 @transition = StateMachine::Transition.new(@object, @machine, :activate, :off, :active) end
test_should_persist()
click to toggle source
# File test/unit/transition_test.rb, line 238 def test_should_persist @transition.persist assert_equal 2, @object.state_id end
test_should_rollback()
click to toggle source
# File test/unit/transition_test.rb, line 243 def test_should_rollback @object.state_id = 2 @transition.rollback assert_equal 1, @object.state_id end