Sha256: a5e03364995b59c148adca85acf0db97e23f4bf5ad0c641b465deb5419f54a42

Contents?: true

Size: 940 Bytes

Versions: 14

Compression:

Stored size: 940 Bytes

Contents

require_relative '../../test_helper'

class BranchWithExceptFromRequirementTest < StateMachinesTest
  def setup
    @object = Object.new
    @branch = StateMachines::Branch.new(except_from: :parked)
  end

  def test_should_use_a_blacklist_matcher
    assert_instance_of StateMachines::BlacklistMatcher, @branch.state_requirements.first[:from]
  end

  def test_should_match_if_not_included
    assert @branch.matches?(@object, from: :idling)
  end

  def test_should_not_match_if_included
    refute @branch.matches?(@object, from: :parked)
  end

  def test_should_match_if_nil
    assert @branch.matches?(@object, from: nil)
  end

  def test_should_ignore_to
    assert @branch.matches?(@object, from: :idling, to: :parked)
  end

  def test_should_ignore_on
    assert @branch.matches?(@object, from: :idling, on: :ignite)
  end

  def test_should_be_included_in_known_states
    assert_equal [:parked], @branch.known_states
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

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