Sha256: 6dc2ced954903f6bc75d80f75804e2809e31e20c129d8f0567e3ca990eacd536

Contents?: true

Size: 844 Bytes

Versions: 14

Compression:

Stored size: 844 Bytes

Contents

require_relative '../../test_helper'

class MachineCollectionTransitionsWithDifferentActionsTest < StateMachinesTest
  def setup
    @klass = Class.new

    @machines = StateMachines::MachineCollection.new
    @machines[:state] = @state = StateMachines::Machine.new(@klass, :state, initial: :parked, action: :save)
    @state.event :ignite do
      transition parked: :idling
    end
    @machines[:status] = @status = StateMachines::Machine.new(@klass, :status, initial: :first_gear, action: :persist)
    @status.event :shift_up do
      transition first_gear: :second_gear
    end

    @object = @klass.new
    @object.state_event = 'ignite'
    @object.status_event = 'shift_up'
    @transitions = @machines.transitions(@object, :save)
  end

  def test_should_only_select_matching_actions
    assert_equal 1, @transitions.length
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

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