Sha256: 4b045934e49dacf0649dfa1fcea8d34fb9797fbaabf2b80c70600ff3723320e7

Contents?: true

Size: 892 Bytes

Versions: 44

Compression:

Stored size: 892 Bytes

Contents

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

describe "the 'tag' 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(:tag)).to eq("function_tag")
  end

  it "should tag the resource with any provided tags" do
    resource = Puppet::Parser::Resource.new(:file, "/file", :scope => @scope)
    @scope.expects(:resource).returns resource

    @scope.function_tag ["one", "two"]

    expect(resource).to be_tagged("one")
    expect(resource).to be_tagged("two")
  end

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

Version data entries

44 entries across 44 versions & 1 rubygems

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