diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2009-11-04 17:57:20 -0800 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-11-10 21:58:50 +1100 |
| commit | 136949da70f1a6715734faa6ac3c464f386fccfb (patch) | |
| tree | b0446e2651ba9ee1bf2ab73128d0284a255fb8fc /spec | |
| parent | cb3e5e10d76a4a0f44e16c5bf36c69b65ae18fbb (diff) | |
| download | puppet-136949da70f1a6715734faa6ac3c464f386fccfb.tar.gz puppet-136949da70f1a6715734faa6ac3c464f386fccfb.tar.xz puppet-136949da70f1a6715734faa6ac3c464f386fccfb.zip | |
Fixing #2631 show_diff sometimes doesn't happen
This patch fixes a code-path in Puppet::Type::File::Content#insync? that
was failing to show a diff when the content's source came from a
template.
I was only able to reproduce one of the two such failures that Malcolm
Howe reported, but I think it's likely that they were both caused by
this same bug.
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/type/file/content.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/type/file/content.rb b/spec/unit/type/file/content.rb index 901d52d74..442de1309 100755 --- a/spec/unit/type/file/content.rb +++ b/spec/unit/type/file/content.rb @@ -197,6 +197,26 @@ describe content do @content.must be_insync("{md5}" + Digest::MD5.hexdigest("some content")) end + describe "and Puppet[:show_diff] is set" do + before do + Puppet[:show_diff] = true + end + + it "should display a diff if the current contents are different from the desired content" do + @content.should = "some content" + @content.expects(:string_file_diff).once + + @content.insync?("other content") + end + + it "should not display a diff if the sum for the current contents is the same as the sum for the desired content" do + @content.should = "some content" + @content.expects(:string_file_diff).never + + @content.insync?("{md5}" + Digest::MD5.hexdigest("some content")) + end + end + describe "and the content is specified via a remote source" do before do @metadata = stub 'metadata' |
