Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Making a Puppet::Module test more resilient

It would fail if a directory unexpectedly existed.

Signed-off-by: Luke Kanies <luke@puppetlabs.com>
  • Loading branch information...
commit da00f682ce0d1778183f9cf7dbe6d2e133b11841 1 parent 9792915
@lak lak authored
Showing with 4 additions and 3 deletions.
  1. +3 −3 lib/puppet/module.rb
  2. +1 −0  spec/unit/module.rb
View
6 lib/puppet/module.rb
@@ -126,10 +126,10 @@ def match_manifests(rest)
return find_init_manifest unless rest # Use init.pp
rest ||= "init.pp"
- p = File::join(path, MANIFESTS, rest)
- result = Dir.glob(p).reject { |f| FileTest.directory?(f) }
+ full_path = File::join(path, MANIFESTS, rest)
+ result = Dir.glob(full_path).reject { |f| FileTest.directory?(f) }
if result.size == 0 and rest !~ /\.pp$/
- result = Dir.glob(p + ".pp")
+ result = Dir.glob(full_path + ".pp")
end
result.flatten.compact
end
View
1  spec/unit/module.rb
@@ -405,6 +405,7 @@
it "should return all manifests matching the glob pattern" do
Dir.expects(:glob).with("/a/manifests/yay/*.pp").returns(%w{foo bar})
+ FileTest.stubs(:directory?).returns false
@mod.match_manifests("yay/*.pp").should == %w{foo bar}
end
Please sign in to comment.
Something went wrong with that request. Please try again.