Sha256: ab2f40ee7171b47f9326142ba98787abd8cd70d21237e6ec2c3cfd9672ca6c99

Contents?: true

Size: 1.08 KB

Versions: 340

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'
require 'puppet/util/multi_match'

describe "The Puppet::Util::MultiMatch" do
  let(:not_nil) { Puppet::Util::MultiMatch::NOT_NIL }
  let(:mm) { Puppet::Util::MultiMatch }

  it "matches against not nil" do
    expect(not_nil === 3).to be(true)
  end

  it "matches against multiple values" do
    expect(mm.new(not_nil, not_nil) === [3, 3]).to be(true)
  end

  it "matches each value using ===" do
    expect(mm.new(3, 3.14) === [Integer, Float]).to be(true)
  end

  it "matches are commutative" do
    expect(mm.new(3, 3.14) === mm.new(Integer, Float)).to be(true)
    expect(mm.new(Integer, Float) === mm.new(3, 3.14)).to be(true)
  end

  it "has TUPLE constant for match of array of two non nil values" do
    expect(mm::TUPLE === [3, 3]).to be(true)
  end

  it "has TRIPLE constant for match of array of two non nil values" do
    expect(mm::TRIPLE === [3, 3, 3]).to be(true)
  end

  it "considers length of array of values when matching" do
    expect(mm.new(not_nil, not_nil) === [6, 6, 6]).to be(false)
    expect(mm.new(not_nil, not_nil) === [6]).to be(false)
  end

end

Version data entries

340 entries across 340 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/unit/util/multi_match_spec.rb
puppet-8.3.0-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-8.3.0-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-8.3.0-universal-darwin spec/unit/util/multi_match_spec.rb
puppet-8.4.0 spec/unit/util/multi_match_spec.rb
puppet-8.4.0-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-8.4.0-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-8.4.0-universal-darwin spec/unit/util/multi_match_spec.rb
puppet-7.28.0 spec/unit/util/multi_match_spec.rb
puppet-7.28.0-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-7.28.0-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-7.28.0-universal-darwin spec/unit/util/multi_match_spec.rb
puppet-8.3.1 spec/unit/util/multi_match_spec.rb
puppet-8.3.1-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-8.3.1-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-8.3.1-universal-darwin spec/unit/util/multi_match_spec.rb
puppet-7.27.0 spec/unit/util/multi_match_spec.rb
puppet-7.27.0-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-7.27.0-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-7.27.0-universal-darwin spec/unit/util/multi_match_spec.rb