Sha256: 833d85c894d45ee5f1860b4043bc4101355dd8cca942da82b044acf094aa90d2

Contents?: true

Size: 869 Bytes

Versions: 14

Compression:

Stored size: 869 Bytes

Contents

require_relative '../../test_helper'

class PathCollectionWithToStateTest < StateMachinesTest
  def setup
    @klass = Class.new
    @machine = StateMachines::Machine.new(@klass)
    @machine.state :parked, :idling
    @machine.event :ignite do
      transition parked: :idling
    end
    @machine.event :shift_up do
      transition parked: :idling, idling: :first_gear
    end
    @machine.event :shift_down do
      transition first_gear: :idling
    end
    @object = @klass.new
    @object.state = 'parked'

    @paths = StateMachines::PathCollection.new(@object, @machine, to: :idling)
  end

  def test_should_stop_paths_once_target_state_reached
    assert_equal [
      [StateMachines::Transition.new(@object, @machine, :ignite, :parked, :idling)],
      [StateMachines::Transition.new(@object, @machine, :shift_up, :parked, :idling)]
    ], @paths
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

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