diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-07-09 17:11:36 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-09 17:26:37 -0700 |
commit | 94fa5d5de2ad8f9d916178bce7ff9eeba748047a (patch) | |
tree | f35df7789d824e26f126b6cc052d04e0959f4c23 /spec/unit | |
parent | 700970475c01f60490f6d05e7a94275ede704c37 (diff) | |
download | puppet-94fa5d5de2ad8f9d916178bce7ff9eeba748047a.tar.gz puppet-94fa5d5de2ad8f9d916178bce7ff9eeba748047a.tar.xz puppet-94fa5d5de2ad8f9d916178bce7ff9eeba748047a.zip |
[#4182] show_diff was broken for streamed file contents
show_diff was written assuming that a file's contents would be loaded
into memory. That's no longer true, for perfomance reasons.
This patch streams the file to a temporary file to take the
diff.
As a consequence, it means that when show_diff is on, files may get
streamed twice.
Diffstat (limited to 'spec/unit')
-rwxr-xr-x | spec/unit/type/file/content_spec.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb index f1001aa8c..2c00e50dc 100755 --- a/spec/unit/type/file/content_spec.rb +++ b/spec/unit/type/file/content_spec.rb @@ -175,14 +175,15 @@ describe content do 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.expects(:diff).returns("my diff").once + @content.expects(:print).with("my 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.expects(:diff).never @content.insync?("{md5}" + Digest::MD5.hexdigest("some content")) end |