summaryrefslogtreecommitdiff
path: root/spec/unit/parser/functions/require_spec.rb
diff options
context:
space:
mode:
authorStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
committerStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
commitd4b83be375ac1dead058e091191ee7c7b7c24c8a (patch)
treedc825687392ae3068de5b764be60c53122d9e02a /spec/unit/parser/functions/require_spec.rb
parent229cbb976fe0f70f5f30548b83517b415840f9bb (diff)
parent1681684857c6e39d60d87b0b3520d8783977ceff (diff)
downloadpuppet-upstream/3.7.0.tar.gz
Imported Upstream version 3.7.0upstream/3.7.0
Diffstat (limited to 'spec/unit/parser/functions/require_spec.rb')
-rwxr-xr-xspec/unit/parser/functions/require_spec.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb
index 72c3f9f5f..f0b4fcc28 100755
--- a/spec/unit/parser/functions/require_spec.rb
+++ b/spec/unit/parser/functions/require_spec.rb
@@ -1,5 +1,6 @@
#! /usr/bin/env ruby
require 'spec_helper'
+require 'unit/parser/functions/shared'
describe "the require function" do
before :all do
@@ -26,13 +27,13 @@ describe "the require function" do
end
it "should delegate to the 'include' puppet function" do
- @scope.expects(:function_include).with(["myclass"])
+ @scope.compiler.expects(:evaluate_classes).with(["myclass"], @scope, false)
@scope.function_require(["myclass"])
end
- it "should set the 'require' prarameter on the resource to a resource reference" do
- @scope.stubs(:function_include)
+ it "should set the 'require' parameter on the resource to a resource reference" do
+ @scope.compiler.stubs(:evaluate_classes)
@scope.function_require(["myclass"])
@resource["require"].should be_instance_of(Array)
@@ -40,7 +41,7 @@ describe "the require function" do
end
it "should lookup the absolute class path" do
- @scope.stubs(:function_include)
+ @scope.compiler.stubs(:evaluate_classes)
@scope.expects(:find_hostclass).with("myclass").returns(@klass)
@klass.expects(:name).returns("myclass")
@@ -49,7 +50,7 @@ describe "the require function" do
end
it "should append the required class to the require parameter" do
- @scope.stubs(:function_include)
+ @scope.compiler.stubs(:evaluate_classes)
one = Puppet::Resource.new(:file, "/one")
@resource[:require] = one
@@ -58,4 +59,17 @@ describe "the require function" do
@resource[:require].should be_include(one)
@resource[:require].detect { |r| r.to_s == "Class[Myclass]" }.should be_instance_of(Puppet::Resource)
end
+
+ describe "When the future parser is in use" do
+ require 'puppet/pops'
+ require 'puppet_spec/compiler'
+ include PuppetSpec::Compiler
+
+ before(:each) do
+ Puppet[:parser] = 'future'
+ end
+
+ it_should_behave_like 'all functions transforming relative to absolute names', :function_require
+ it_should_behave_like 'an inclusion function, regardless of the type of class reference,', :require
+ end
end