Sha256: c3cc3bf22284ffd90e2f9685476cba6a1d167e037c6f112a06719d6f6eade531

Contents?: true

Size: 880 Bytes

Versions: 14

Compression:

Stored size: 880 Bytes

Contents

require_relative '../../test_helper'

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

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

  def test_should_not_include_duplicates_in_from_states
    assert_equal [:parked, :idling, :first_gear], @paths.from_states
  end

  def test_should_not_include_duplicates_in_to_states
    assert_equal [:idling, :first_gear], @paths.to_states
  end

  def test_should_not_include_duplicates_in_events
    assert_equal [:shift_up, :park], @paths.events
  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_duplicate_nodes_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.4.0 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.3.0 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.2.2 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.2.1 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.2.0 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.1.4 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.1.3 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.1.2 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.1.1 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb
state_machines-0.1.0 test/unit/path_collection/path_collection_with_duplicate_nodes_test.rb