summaryrefslogtreecommitdiff
path: root/spec/unit/parser/files_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/files_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/files_spec.rb')
-rwxr-xr-xspec/unit/parser/files_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/unit/parser/files_spec.rb b/spec/unit/parser/files_spec.rb
index 3eb43b276..020ce740b 100755
--- a/spec/unit/parser/files_spec.rb
+++ b/spec/unit/parser/files_spec.rb
@@ -12,6 +12,25 @@ describe Puppet::Parser::Files do
@basepath = make_absolute("/somepath")
end
+ describe "when searching for files" do
+ it "should return fully-qualified files directly" do
+ Puppet::Parser::Files.expects(:modulepath).never
+ Puppet::Parser::Files.find_file(@basepath + "/my/file", environment).should == @basepath + "/my/file"
+ end
+
+ it "should return the first found file" do
+ mod = mock 'module'
+ mod.expects(:file).returns("/one/mymod/files/myfile")
+ environment.expects(:module).with("mymod").returns mod
+
+ Puppet::Parser::Files.find_file("mymod/myfile", environment).should == "/one/mymod/files/myfile"
+ end
+
+ it "should return nil if template is not found" do
+ Puppet::Parser::Files.find_file("foomod/myfile", environment).should be_nil
+ end
+ end
+
describe "when searching for templates" do
it "should return fully-qualified templates directly" do
Puppet::Parser::Files.expects(:modulepath).never