Sha256: 79525f1ff62773e717c46b6d843dfb607c9dce8ea95b89f496c5c810ea1af52e

Contents?: true

Size: 1.1 KB

Versions: 248

Compression:

Stored size: 1.1 KB

Contents

#! /usr/bin/env ruby
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

248 entries across 248 versions & 1 rubygems

Version Path
puppet-6.4.0 spec/unit/util/multi_match_spec.rb
puppet-6.4.0-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-6.4.0-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-6.4.0-universal-darwin spec/unit/util/multi_match_spec.rb
puppet-6.0.7 spec/unit/util/multi_match_spec.rb
puppet-6.0.7-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-6.0.7-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-6.0.7-universal-darwin spec/unit/util/multi_match_spec.rb
puppet-5.5.12 spec/unit/util/multi_match_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-5.5.12-universal-darwin spec/unit/util/multi_match_spec.rb
puppet-6.3.0 spec/unit/util/multi_match_spec.rb
puppet-6.3.0-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-6.3.0-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-6.3.0-universal-darwin spec/unit/util/multi_match_spec.rb
puppet-6.2.0 spec/unit/util/multi_match_spec.rb
puppet-6.2.0-x86-mingw32 spec/unit/util/multi_match_spec.rb
puppet-6.2.0-x64-mingw32 spec/unit/util/multi_match_spec.rb
puppet-6.2.0-universal-darwin spec/unit/util/multi_match_spec.rb