diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-12-16 14:10:20 -0800 |
|---|---|---|
| committer | Jesse Wolfe <jes5199@gmail.com> | 2010-12-16 14:34:56 -0800 |
| commit | e99a3ea6fc2b30ed7bcbd3c1bc011b38d92f57b2 (patch) | |
| tree | 4ac0978edcb7c7b10ea2cd6209f500a19a65cba4 /spec/unit | |
| parent | 3f9f37984d1ac5f3ddcc83bf2b1facdb6df6dacd (diff) | |
| download | puppet-e99a3ea6fc2b30ed7bcbd3c1bc011b38d92f57b2.tar.gz puppet-e99a3ea6fc2b30ed7bcbd3c1bc011b38d92f57b2.tar.xz puppet-e99a3ea6fc2b30ed7bcbd3c1bc011b38d92f57b2.zip | |
Fix #5566 none, mtime, and ctime checksum types can write file contents
The #write method in lib/puppet/type/file/content.rb relies on the block
passed to #sum_stream getting executed. "none", "mtime", and "ctime"
aren't real checksums, so they violated that assumption and just
returned empty results. This patch causes that block to get executed.
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/util/checksums_spec.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/unit/util/checksums_spec.rb b/spec/unit/util/checksums_spec.rb index e018581af..a8bc12be2 100755 --- a/spec/unit/util/checksums_spec.rb +++ b/spec/unit/util/checksums_spec.rb @@ -140,7 +140,9 @@ describe Puppet::Util::Checksums do end it "should return nil for streams" do - @summer.send(sum.to_s + "_stream").should be_nil + expectation = stub "expectation" + expectation.expects(:do_something!).at_least_once + @summer.send(sum.to_s + "_stream"){ |checksum| checksum << "anything" ; expectation.do_something! }.should be_nil end end end @@ -149,5 +151,11 @@ describe Puppet::Util::Checksums do it "should return an empty string" do @summer.none_file("/my/file").should == "" end + + it "should return an empty string for streams" do + expectation = stub "expectation" + expectation.expects(:do_something!).at_least_once + @summer.none_stream{ |checksum| checksum << "anything" ; expectation.do_something! }.should == "" + end end end |
