Sha256: d35f6ccad36188d76cf965b25e6b64eb9a53cf0df7815020023a5e6381a52a68

Contents?: true

Size: 770 Bytes

Versions: 14

Compression:

Stored size: 770 Bytes

Contents

require_relative '../../test_helper'
class PathWithGuardedPathsTest < StateMachinesTest
  def setup
    @klass = Class.new
    @machine = StateMachines::Machine.new(@klass)
    @machine.state :parked, :idling, :first_gear
    @machine.event :ignite do
      transition parked: :idling, if: lambda { false }
    end

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

  def test_should_not_enumerate_paths_if_guard_enabled
    assert_equal [], StateMachines::PathCollection.new(@object, @machine)
  end

  def test_should_enumerate_paths_if_guard_disabled
    paths = StateMachines::PathCollection.new(@object, @machine, guard: false)
    assert_equal [[
      StateMachines::Transition.new(@object, @machine, :ignite, :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_with_guarded_paths_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/path_collection/path_with_guarded_paths_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/path_collection/path_with_guarded_paths_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.4.0 test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.3.0 test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.2.2 test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.2.1 test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.2.0 test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.1.4 test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.1.3 test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.1.2 test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.1.1 test/unit/path_collection/path_with_guarded_paths_test.rb
state_machines-0.1.0 test/unit/path_collection/path_with_guarded_paths_test.rb