blob: 67227e7d99997baa3ce6a2fb995c4718f1bcfbcf (
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
28
29
30
31
32
33
|
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
describe "the 'include' function" do
before :each do
Puppet::Node::Environment.stubs(:current).returns(nil)
@compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("foo"))
@scope = Puppet::Parser::Scope.new(:compiler => @compiler)
end
it "should exist" do
Puppet::Parser::Functions.function("include").should == "function_include"
end
it "should include a single class" do
inc = "foo"
@compiler.expects(:evaluate_classes).with {|klasses,parser,lazy| klasses == [inc]}.returns([inc])
@scope.function_include("foo")
end
it "should include multiple classes" do
inc = ["foo","bar"]
@compiler.expects(:evaluate_classes).with {|klasses,parser,lazy| klasses == inc}.returns(inc)
@scope.function_include(["foo","bar"])
end
it "should not lazily evaluate the included class" do
@compiler.expects(:evaluate_classes).with {|klasses,parser,lazy| lazy == false}.returns("foo")
@scope.function_include("foo")
end
end
|