Sha256: 2887d0c46a71dd0053df08ac17982fc8d4fc60773a1212557f0d76f6725773b8

Contents?: true

Size: 858 Bytes

Versions: 14

Compression:

Stored size: 858 Bytes

Contents

require_relative '../../test_helper'

class MachineAfterChangingOwnerClassTest < StateMachinesTest
  def setup
    @original_class = Class.new
    @machine = StateMachines::Machine.new(@original_class)

    @new_class = Class.new(@original_class)
    @new_machine = @machine.clone
    @new_machine.owner_class = @new_class

    @object = @new_class.new
  end

  def test_should_update_owner_class
    assert_equal @new_class, @new_machine.owner_class
  end

  def test_should_not_change_original_owner_class
    assert_equal @original_class, @machine.owner_class
  end

  def test_should_change_the_associated_machine_in_the_new_class
    assert_equal @new_machine, @new_class.state_machines[:state]
  end

  def test_should_not_change_the_associated_machine_in_the_original_class
    assert_equal @machine, @original_class.state_machines[:state]
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
state_machines-0.5.0 test/unit/machine/machine_after_changing_owner_class_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/machine/machine_after_changing_owner_class_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/machine/machine_after_changing_owner_class_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.4.0 test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.3.0 test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.2.2 test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.2.1 test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.2.0 test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.1.4 test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.1.3 test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.1.2 test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.1.1 test/unit/machine/machine_after_changing_owner_class_test.rb
state_machines-0.1.0 test/unit/machine/machine_after_changing_owner_class_test.rb