summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/functions/tag_spec.rb
blob: 5fb467e5968e9a4ec67a9a49d2d7c238f05c1c2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/env ruby

require File.dirname(__FILE__) + '/../../../spec_helper'

describe "the 'tag' function" do

    before :each do
        @scope = Puppet::Parser::Scope.new()
    end

    it "should exist" do
        Puppet::Parser::Functions.function(:tag).should == "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"]

        resource.should be_tagged("one")
        resource.should be_tagged("two")
    end
end