diff options
Diffstat (limited to 'spec/unit/type/tidy.rb')
-rwxr-xr-x | spec/unit/type/tidy.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/unit/type/tidy.rb b/spec/unit/type/tidy.rb index 72f6b0f10..e17f65de4 100755 --- a/spec/unit/type/tidy.rb +++ b/spec/unit/type/tidy.rb @@ -2,13 +2,26 @@ require File.dirname(__FILE__) + '/../../spec_helper' -describe Puppet::Type.type(:tidy) do +tidy = Puppet::Type.type(:tidy) + +describe tidy do + before do + Puppet.settings.stubs(:use) + end + it "should use :lstat when stating a file" do tidy = Puppet::Type.type(:tidy).new :path => "/foo/bar", :age => "1d" stat = mock 'stat' File.expects(:lstat).with("/foo/bar").returns stat tidy.stat("/foo/bar").should == stat end + + it "should be in sync if the targeted file does not exist" do + File.expects(:lstat).with("/tmp/foonesslaters").raises Errno::ENOENT + @tidy = tidy.create :path => "/tmp/foonesslaters", :age => "100d" + + @tidy.property(:ensure).must be_insync({}) + end [:age, :size, :path, :matches, :type, :recurse, :rmdirs].each do |param| it "should have a %s parameter" % param do |