Sha256: 2d3b6a9ab2f3eb6135143f2b7d0eb6de4f588ce18d41ce3e3762bb3f1018d5da
Contents?: true
Size: 691 Bytes
Versions: 14
Compression:
Stored size: 691 Bytes
Contents
require_relative '../../test_helper' class TransitionWithCustomMachineAttributeTest < StateMachinesTest def setup @klass = Class.new @machine = StateMachines::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 = StateMachines::Transition.new(@object, @machine, :activate, :off, :active) end def test_should_persist @transition.persist assert_equal 2, @object.state_id end def test_should_rollback @object.state_id = 2 @transition.rollback assert_equal 1, @object.state_id end end
Version data entries
14 entries across 14 versions & 2 rubygems