Sha256: 70e80d72cfcbb302f55f0d97e4141be93ed4cf21994776ef9a601784d5e78849

Contents?: true

Size: 1.18 KB

Versions: 20

Compression:

Stored size: 1.18 KB

Contents

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

describe "the 'tagged' function" do
  before :all do
    Puppet::Parser::Functions.autoloader.loadall
  end

  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

20 entries across 20 versions & 1 rubygems

Version Path
puppet-5.5.12 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.12-universal-darwin spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.10 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.10-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.10-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.10-universal-darwin spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.8 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.8-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.8-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.8-universal-darwin spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.7 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.7-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.7-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.7-universal-darwin spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.6 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.6-x86-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.6-x64-mingw32 spec/unit/parser/functions/tagged_spec.rb
puppet-5.5.6-universal-darwin spec/unit/parser/functions/tagged_spec.rb