diff options
-rw-r--r-- | lib/puppet/type/file.rb | 5 | ||||
-rwxr-xr-x | spec/unit/type/tidy.rb | 19 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 35eccef83..c55ff29a7 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -729,11 +729,6 @@ module Puppet method = :lstat end path = self[:path] - # Just skip them when they don't exist at all. - unless FileTest.exists?(path) or FileTest.symlink?(path) - @stat = nil - return @stat - end if @stat.nil? or refresh == true begin @stat = File.send(method, self[:path]) diff --git a/spec/unit/type/tidy.rb b/spec/unit/type/tidy.rb index 89f178389..5ebc674aa 100755 --- a/spec/unit/type/tidy.rb +++ b/spec/unit/type/tidy.rb @@ -2,33 +2,38 @@ require File.dirname(__FILE__) + '/../../spec_helper' -tidy = Puppet::Type.type(:tidy) +describe Puppet::Type.type(:tidy) do + it "should use :lstat when stating a file" do + tidy = Puppet::Type.type(:tidy).create :path => "/foo/bar", :age => "1d" + stat = mock 'stat' + File.expects(:lstat).with("/foo/bar").returns stat + tidy.stat.should == stat + end -describe tidy do [:ensure, :age, :size].each do |property| it "should have a %s property" % property do - tidy.attrclass(property).ancestors.should be_include(Puppet::Property) + Puppet::Type.type(:tidy).attrclass(property).ancestors.should be_include(Puppet::Property) end it "should have documentation for its %s property" % property do - tidy.attrclass(property).doc.should be_instance_of(String) + Puppet::Type.type(:tidy).attrclass(property).doc.should be_instance_of(String) end end [:path, :matches, :type, :recurse, :rmdirs].each do |param| it "should have a %s parameter" % param do - tidy.attrclass(param).ancestors.should be_include(Puppet::Parameter) + Puppet::Type.type(:tidy).attrclass(param).ancestors.should be_include(Puppet::Parameter) end it "should have documentation for its %s param" % param do - tidy.attrclass(param).doc.should be_instance_of(String) + Puppet::Type.type(:tidy).attrclass(param).doc.should be_instance_of(String) end end describe "when validating parameter values" do describe "for 'recurse'" do before do - @tidy = tidy.create :path => "/tmp", :age => "100d" + @tidy = Puppet::Type.type(:tidy).create :path => "/tmp", :age => "100d" end it "should allow 'true'" do |