summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/functions/tag_spec.rb
blob: e8a07e1bb25da57f6f2bb4fcfb0b714b8eab6005 (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
25
26
27
#!/usr/bin/env rspec
require 'spec_helper'

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

  before :each do
    @scope = Puppet::Parser::Scope.new
    @scope.stubs(:environment).returns(nil)
  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