Sha256: 04f55aaa5c2335fa0096cdd7a548581bbb2e0480c870c9fcd0ba8e57a712bdd2

Contents?: true

Size: 1.11 KB

Versions: 44

Compression:

Stored size: 1.11 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

describe "the 'tagged' function" do
  before :each do
    node     = Puppet::Node.new('localhost')
    compiler = Puppet::Parser::Compiler.new(node)
    @scope   = Puppet::Parser::Scope.new(compiler)
  end

  it "should exist" do
    expect(Puppet::Parser::Functions.function(:tagged)).to eq("function_tagged")
  end

  it 'is not available when --tasks is on' do
    Puppet[:tasks] = true
    expect do
      @scope.function_tagged(['one', 'two'])
    end.to raise_error(Puppet::ParseError, /is only available when compiling a catalog/)
  end

  it 'should be case-insensitive' do
    resource = Puppet::Parser::Resource.new(:file, "/file", :scope => @scope)
    @scope.stubs(:resource).returns resource
    @scope.function_tag ["one"]

    expect(@scope.function_tagged(['One'])).to eq(true)
  end

  it 'should check if all specified tags are included' do
    resource = Puppet::Parser::Resource.new(:file, "/file", :scope => @scope)
    @scope.stubs(:resource).returns resource
    @scope.function_tag ["one"]

    expect(@scope.function_tagged(['one', 'two'])).to eq(false)
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
puppet-6.4.0 spec/unit/parser/functions/tagged_spec.rb
puppet-6.4.0-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.4.0-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.4.0-universal-darwin spec/unit/parser/functions/tagged_spec.rb
puppet-6.0.7 spec/unit/parser/functions/tagged_spec.rb
puppet-6.0.7-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.0.7-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.0.7-universal-darwin spec/unit/parser/functions/tagged_spec.rb
puppet-6.3.0 spec/unit/parser/functions/tagged_spec.rb
puppet-6.3.0-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.3.0-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.3.0-universal-darwin spec/unit/parser/functions/tagged_spec.rb
puppet-6.2.0 spec/unit/parser/functions/tagged_spec.rb
puppet-6.2.0-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.2.0-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.2.0-universal-darwin spec/unit/parser/functions/tagged_spec.rb
puppet-6.0.5 spec/unit/parser/functions/tagged_spec.rb
puppet-6.0.5-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.0.5-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-6.0.5-universal-darwin spec/unit/parser/functions/tagged_spec.rb