0001-Fixing-2631-show_diff-sometimes-doesn-t-happen.patch
| b/lib/puppet/type/file/content.rb | ||
|---|---|---|
| 96 | 96 |
return true if ! @resource.replace? |
| 97 | 97 | |
| 98 | 98 |
if self.should |
| 99 |
return super
|
|
| 99 |
result = super
|
|
| 100 | 100 |
elsif source = resource.parameter(:source) |
| 101 | 101 |
fail "Got a remote source with no checksum" unless source.checksum |
| 102 | 102 |
result = (is == source.checksum) |
| b/spec/unit/type/file/content.rb | ||
|---|---|---|
| 188 | 188 |
@content.must be_insync("{md5}" + Digest::MD5.hexdigest("some content"))
|
| 189 | 189 |
end |
| 190 | 190 | |
| 191 |
describe "and Puppet[:show_diff] is set" do |
|
| 192 |
before do |
|
| 193 |
Puppet[:show_diff] = true |
|
| 194 |
end |
|
| 195 | ||
| 196 |
it "should display a diff if the current contents are different from the desired content" do |
|
| 197 |
@content.should = "some content" |
|
| 198 |
@content.expects(:string_file_diff).once |
|
| 199 | ||
| 200 |
@content.insync?("other content")
|
|
| 201 |
end |
|
| 202 | ||
| 203 |
it "should not display a diff if the sum for the current contents is the same as the sum for the desired content" do |
|
| 204 |
@content.should = "some content" |
|
| 205 |
@content.expects(:string_file_diff).never |
|
| 206 | ||
| 207 |
@content.insync?("{md5}" + Digest::MD5.hexdigest("some content"))
|
|
| 208 |
end |
|
| 209 |
end |
|
| 210 | ||
| 191 | 211 |
describe "and the content is specified via a remote source" do |
| 192 | 212 |
before do |
| 193 | 213 |
@metadata = stub 'metadata' |
| 194 |
- |
|