diff options
author | Luke Kanies <luke@madstop.com> | 2009-02-17 12:26:58 -0600 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-02-18 08:18:57 +1100 |
commit | d758f45a14057f0b9517a1905d575d6b28b90bc2 (patch) | |
tree | fb92dddbd77f81d612f88ab9eb4afc1d47c6c846 /spec/unit | |
parent | c0f494334b374d6f0b0eb3d5741aaff70052d564 (diff) | |
download | puppet-d758f45a14057f0b9517a1905d575d6b28b90bc2.tar.gz puppet-d758f45a14057f0b9517a1905d575d6b28b90bc2.tar.xz puppet-d758f45a14057f0b9517a1905d575d6b28b90bc2.zip |
Fixing #1871 once and for all - contents are never printed
They were still being printed in noop mode.
The fix was to use is_to_s and should_to_s methods,
rather than 'change_to_s'.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-x | spec/unit/type/file/content.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/unit/type/file/content.rb b/spec/unit/type/file/content.rb new file mode 100755 index 000000000..8bcac8af5 --- /dev/null +++ b/spec/unit/type/file/content.rb @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby + +Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") } + +property = Puppet::Type.type(:file).attrclass(:content) + +describe property do + before do + @resource = stub 'resource', :line => "foo", :file => "bar", :replace? => true + @resource.stubs(:[]).returns "foo" + @resource.stubs(:[]).with(:path).returns "/my/file" + @content = property.new :resource => @resource + end + + it "should not include current contents when producing a change log" do + @content.change_to_s("current_content", "desired").should_not be_include("current_content") + end + + it "should not include desired contents when producing a change log" do + @content.change_to_s("current", "desired_content").should_not be_include("desired_content") + end + + it "should not include the content when converting current content to a string" do + @content.is_to_s("my_content").should_not be_include("my_content") + end + + it "should not include the content when converting desired content to a string" do + @content.should_to_s("my_content").should_not be_include("my_content") + end +end |