Sha256: c507d8115552e99317e1b8a826e07507ff79a96119416721b77ce28c7ed316eb

Contents?: true

Size: 709 Bytes

Versions: 14

Compression:

Stored size: 709 Bytes

Contents

require_relative '../../test_helper'

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

    @object = @klass.new
    @object.state = 'parked'

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

  def test_should_generate_paths_from_custom_from_state
    assert_equal [[
      StateMachines::Transition.new(@object, @machine, :park, :idling, :parked)
    ]], @paths
  end

  def test_should_have_a_from_name
    assert_equal :idling, @paths.from_name
  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_from_state_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/path_collection/path_collection_with_from_state_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/path_collection/path_collection_with_from_state_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.4.0 test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.3.0 test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.2.2 test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.2.1 test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.2.0 test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.1.4 test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.1.3 test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.1.2 test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.1.1 test/unit/path_collection/path_collection_with_from_state_test.rb
state_machines-0.1.0 test/unit/path_collection/path_collection_with_from_state_test.rb