summaryrefslogtreecommitdiffstats
path: root/spec/unit/file_serving
diff options
context:
space:
mode:
authorPaul Nasrat <pnasrat@googlemail.com>2008-09-19 11:41:45 +0100
committerJames Turnbull <james@lovedthanlost.net>2008-09-30 22:21:49 +1000
commitaf8c70650b028a70ed50ac6c2bd7f4f00c17ae03 (patch)
tree0a64e59476b9f3d285731875ec57fba69b818785 /spec/unit/file_serving
parent860bdb120df93c3ad9f323529f22f71ca8548cf8 (diff)
downloadpuppet-af8c70650b028a70ed50ac6c2bd7f4f00c17ae03.tar.gz
puppet-af8c70650b028a70ed50ac6c2bd7f4f00c17ae03.tar.xz
puppet-af8c70650b028a70ed50ac6c2bd7f4f00c17ae03.zip
Fix metadata class for cases when checksum_type set
Diffstat (limited to 'spec/unit/file_serving')
-rwxr-xr-xspec/unit/file_serving/metadata.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/unit/file_serving/metadata.rb b/spec/unit/file_serving/metadata.rb
index 9743370c1..60fcbc3d3 100755
--- a/spec/unit/file_serving/metadata.rb
+++ b/spec/unit/file_serving/metadata.rb
@@ -99,6 +99,14 @@ describe Puppet::FileServing::Metadata, " when collecting attributes" do
@metadata.checksum.should == "{md5}" + @checksum
end
+ it "should give a mtime checksum when checksum_type is set" do
+ time = Time.now
+ @metadata.checksum_type = "mtime"
+ @metadata.expects(:mtime_file).returns(@time)
+ @metadata.collect_attributes
+ @metadata.checksum.should == "{mtime}" + @time.to_s
+ end
+
it "should produce tab-separated mode, type, owner, group, and checksum for xmlrpc" do
@metadata.attributes_with_tabs.should == "#{0755.to_s}\tfile\t10\t20\t{md5}#{@checksum}"
end
@@ -109,14 +117,22 @@ describe Puppet::FileServing::Metadata, " when collecting attributes" do
@stat.stubs(:ftype).returns("directory")
@time = Time.now
@metadata.expects(:ctime_file).returns(@time)
- @metadata.collect_attributes
end
it "should only use checksums of type 'ctime' for directories" do
+ @metadata.collect_attributes
+ @metadata.checksum.should == "{ctime}" + @time.to_s
+ end
+
+ it "should only use checksums of type 'ctime' for directories even if checksum_type set" do
+ @metadata.checksum_type = "mtime"
+ @metadata.expects(:mtime_file).never
+ @metadata.collect_attributes
@metadata.checksum.should == "{ctime}" + @time.to_s
end
it "should produce tab-separated mode, type, owner, group, and checksum for xmlrpc" do
+ @metadata.collect_attributes
@metadata.attributes_with_tabs.should == "#{0755.to_s}\tdirectory\t10\t20\t{ctime}#{@time.to_s}"
end
end