Sha256: edd07d0f0545b9d53d781af48bda7b02c574e910f7007dabbe21c5010df3920a

Contents?: true

Size: 727 Bytes

Versions: 13

Compression:

Stored size: 727 Bytes

Contents

require_relative 'test_helper'

class MachineWithDirtyAttributeAndCustomAttributesDuringLoopbackTest < BaseTestCase
  def setup
    @model = new_model do
      include ActiveModel::Dirty
      model_attribute :status
      define_attribute_methods [:status]
    end
    @machine = StateMachines::Machine.new(@model, :status, initial: :parked)
    @machine.event :park

    @record = @model.create

    @transition = StateMachines::Transition.new(@record, @machine, :park, :parked, :parked)
    @transition.perform
  end

  def test_should_not_include_state_in_changed_attributes
    assert_equal [], @record.changed
  end

  def test_should_not_track_attribute_changes
    assert_equal nil, @record.changes['status']
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
state_machines-activemodel-0.5.0 test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
state_machines-activemodel-0.4.1 test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
state_machines-activemodel-0.4.0 test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
state_machines-activemodel-0.4.0.pre test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-activemodel-0.1.2/test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-activemodel-0.1.2/test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-activemodel-0.1.2/test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
state_machines-activemodel-0.3.0 test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
state_machines-activemodel-0.2.0 test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
state_machines-activemodel-0.1.2 test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
state_machines-activemodel-0.1.1 test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
state_machines-activemodel-0.1.0 test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
state_machines-activemodel-0.0.3 test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb