Sha256: 60be0f4a350aa33fda981ffc91131e5acb90f91d7f24ff19ea6ebfd0b5c0d673

Contents?: true

Size: 789 Bytes

Versions: 14

Compression:

Stored size: 789 Bytes

Contents

require_relative '../../test_helper'

class WhitelistMatcherTest < StateMachinesTest
  def setup
    @matcher = StateMachines::WhitelistMatcher.new([:parked, :idling])
  end

  def test_should_have_values
    assert_equal [:parked, :idling], @matcher.values
  end

  def test_should_filter_unknown_values
    assert_equal [:parked, :idling], @matcher.filter([:parked, :idling, :first_gear])
  end

  def test_should_match_known_values
    assert @matcher.matches?(:parked)
  end

  def test_should_not_match_unknown_values
    refute @matcher.matches?(:first_gear)
  end

  def test_should_have_a_description
    assert_equal '[:parked, :idling]', @matcher.description

    matcher = StateMachines::WhitelistMatcher.new([:parked])
    assert_equal ':parked', matcher.description
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

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