summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/module_spec.rb27
-rw-r--r--spec/unit/parser/files_spec.rb4
2 files changed, 16 insertions, 15 deletions
diff --git a/spec/unit/module_spec.rb b/spec/unit/module_spec.rb
index 85cc84116..fcc5e60b5 100755
--- a/spec/unit/module_spec.rb
+++ b/spec/unit/module_spec.rb
@@ -401,46 +401,47 @@ describe Puppet::Module, "when finding matching manifests" do
before do
@mod = Puppet::Module.new("mymod")
@mod.stubs(:path).returns "/a"
+ @pq_glob_with_extension = "yay/*.xx"
+ @fq_glob_with_extension = "/a/manifests/" + @pq_glob_with_extension
end
it "should return all manifests matching the glob pattern" do
- Dir.expects(:glob).with("/a/manifests/yay/*.pp").returns(%w{foo bar})
+ Dir.expects(:glob).with(@fq_glob_with_extension).returns(%w{foo bar})
FileTest.stubs(:directory?).returns false
- @mod.match_manifests("yay/*.pp").should == %w{foo bar}
+ @mod.match_manifests(@pq_glob_with_extension).should == %w{foo bar}
end
it "should not return directories" do
- Dir.expects(:glob).with("/a/manifests/yay/*.pp").returns(%w{foo bar})
+ Dir.expects(:glob).with(@fq_glob_with_extension).returns(%w{foo bar})
FileTest.expects(:directory?).with("foo").returns false
FileTest.expects(:directory?).with("bar").returns true
- @mod.match_manifests("yay/*.pp").should == %w{foo}
+ @mod.match_manifests(@pq_glob_with_extension).should == %w{foo}
end
- it "should default to the 'init.pp' file if no glob pattern is specified" do
- FileTest.stubs(:exist?).returns true
+ it "should default to the 'init' file if no glob pattern is specified" do
+ Dir.expects(:glob).with("/a/manifests/init.{pp,rb}").returns(%w{/a/manifests/init.pp})
@mod.match_manifests(nil).should == %w{/a/manifests/init.pp}
end
it "should return all manifests matching the glob pattern in all existing paths" do
- Dir.expects(:glob).with("/a/manifests/yay/*.pp").returns(%w{a b})
+ Dir.expects(:glob).with(@fq_glob_with_extension).returns(%w{a b})
- @mod.match_manifests("yay/*.pp").should == %w{a b}
+ @mod.match_manifests(@pq_glob_with_extension).should == %w{a b}
end
- it "should match the glob pattern plus '.pp' if no results are found" do
- Dir.expects(:glob).with("/a/manifests/yay/foo").returns([])
- Dir.expects(:glob).with("/a/manifests/yay/foo.pp").returns(%w{yay})
+ it "should match the glob pattern plus '.{pp,rb}' if no extention is specified" do
+ Dir.expects(:glob).with("/a/manifests/yay/foo.{pp,rb}").returns(%w{yay})
@mod.match_manifests("yay/foo").should == %w{yay}
end
it "should return an empty array if no manifests matched" do
- Dir.expects(:glob).with("/a/manifests/yay/*.pp").returns([])
+ Dir.expects(:glob).with(@fq_glob_with_extension).returns([])
- @mod.match_manifests("yay/*.pp").should == []
+ @mod.match_manifests(@pq_glob_with_extension).should == []
end
end
diff --git a/spec/unit/parser/files_spec.rb b/spec/unit/parser/files_spec.rb
index 89215344b..df96c0e4c 100644
--- a/spec/unit/parser/files_spec.rb
+++ b/spec/unit/parser/files_spec.rb
@@ -154,7 +154,7 @@ describe Puppet::Parser::Files do
it "should match against provided fully qualified patterns" do
pattern = @basepath + "/fully/qualified/pattern/*"
- Dir.expects(:glob).with(pattern).returns(%w{my file list})
+ Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns(%w{my file list})
Puppet::Parser::Files.find_manifests(pattern)[1].should == %w{my file list}
end
@@ -168,7 +168,7 @@ describe Puppet::Parser::Files do
pattern = @basepath + "/fully/qualified/pattern/*"
file = @basepath + "/my/file"
dir = @basepath + "/my/directory"
- Dir.expects(:glob).with(pattern).returns([file, dir])
+ Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns([file, dir])
FileTest.expects(:directory?).with(file).returns(false)
FileTest.expects(:directory?).with(dir).returns(true)
Puppet::Parser::Files.find_manifests(pattern)[1].should == [file]