Sha256: 3970b9749c344ec65a7d5b9542c3390523e19ba2ec3463a0c59e7d3c4822acd2
Contents?: true
Size: 910 Bytes
Versions: 3
Compression:
Stored size: 910 Bytes
Contents
require_relative 'test_helper' class MachineWithEventAttributesOnCustomActionTest < BaseTestCase def setup @superclass = new_model do def persist upsert end end @model = Class.new(@superclass) @machine = StateMachines::Machine.new(@model, :action => :persist) @machine.event :ignite do transition :parked => :idling end @record = @model.new @record.state = 'parked' @record.state_event = 'ignite' end def test_should_not_transition_on_valid? @record.valid? assert_equal 'parked', @record.state end def test_should_not_transition_on_save @record.save assert_equal 'parked', @record.state end def test_should_not_transition_on_save! @record.save! assert_equal 'parked', @record.state end def test_should_transition_on_custom_action @record.persist assert_equal 'idling', @record.state end end
Version data entries
3 entries across 3 versions & 1 rubygems