Sha256: a8da061a9e34caef300de995b897f7250ce9274d074b28407e2866e325e69fae

Contents?: true

Size: 748 Bytes

Versions: 11

Compression:

Stored size: 748 Bytes

Contents

require_relative '../../test_helper'

class TransitionCollectionWithoutTransactionsTest < StateMachinesTest
  def setup
    @klass = Class.new do
      attr_accessor :ran_transaction
    end

    @machine = StateMachines::Machine.new(@klass, initial: :parked)
    @machine.state :idling
    @machine.event :ignite

    class << @machine
      def within_transaction(object)
        object.ran_transaction = true
      end
    end

    @object = @klass.new
    @transitions = StateMachines::TransitionCollection.new([
      StateMachines::Transition.new(@object, @machine, :ignite, :parked, :idling)
    ], transaction: false)
    @transitions.perform
  end

  def test_should_not_run_within_transaction
    refute @object.ran_transaction
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/transition_collection_without_transactions_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/transition_collection_without_transactions_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/transition_collection_without_transactions_test.rb
state_machines-0.2.2 test/unit/transition_collection/transition_collection_without_transactions_test.rb
state_machines-0.2.1 test/unit/transition_collection/transition_collection_without_transactions_test.rb
state_machines-0.2.0 test/unit/transition_collection/transition_collection_without_transactions_test.rb
state_machines-0.1.4 test/unit/transition_collection/transition_collection_without_transactions_test.rb
state_machines-0.1.3 test/unit/transition_collection/transition_collection_without_transactions_test.rb
state_machines-0.1.2 test/unit/transition_collection/transition_collection_without_transactions_test.rb
state_machines-0.1.1 test/unit/transition_collection/transition_collection_without_transactions_test.rb
state_machines-0.1.0 test/unit/transition_collection/transition_collection_without_transactions_test.rb