4
describe Puppet::Type.type(:file).attrclass(:mtime) do
5
require 'puppet_spec/files'
6
include PuppetSpec::Files
9
@filename = tmpfile('mtime')
10
@resource = Puppet::Type.type(:file).new({:name => @filename})
13
it "should be able to audit the file's mtime" do
14
File.open(@filename, "w"){ }
16
@resource[:audit] = [:mtime]
18
# this .to_resource audit behavior is magical :-(
19
@resource.to_resource[:mtime].should == File.stat(@filename).mtime
22
it "should return absent if auditing an absent file" do
23
@resource[:audit] = [:mtime]
25
@resource.to_resource[:mtime].should == :absent
28
it "should prevent the user from trying to set the mtime" do
30
@resource[:mtime] = Time.now.to_s
31
}.should raise_error(Puppet::Error, /mtime is read-only/)