summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/type/file/content_spec.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb
index 9178c94bf..5ee26cc52 100755
--- a/spec/unit/type/file/content_spec.rb
+++ b/spec/unit/type/file/content_spec.rb
@@ -474,17 +474,38 @@ describe content do
@content.each_chunk_from('i_am_a_string') { |chunk| chunk.should == 'i_am_a_string' }
end
+ # The following manifest is a case where source and content.should are both set
+ # file { "/tmp/mydir" :
+ # source => '/tmp/sourcedir',
+ # recurse => true,
+ # }
+ it "when content checksum comes from source" do
+ source_param = Puppet::Type.type(:file).attrclass(:source)
+ source = source_param.new(:resource => @resource)
+ @content.should = "{md5}123abcd"
+
+ @content.expects(:chunk_file_from_source).returns('from_source')
+ @content.each_chunk_from(source) { |chunk| chunk.should == 'from_source' }
+ end
+
it "when no content, source, but ensure present" do
@resource[:ensure] = :present
@content.each_chunk_from(nil) { |chunk| chunk.should == '' }
end
+ # you might do this if you were just auditing
it "when no content, source, but ensure file" do
@resource[:ensure] = :file
@content.each_chunk_from(nil) { |chunk| chunk.should == '' }
end
- it "when no content or source" do
+ it "when source_or_content is nil and content not a checksum" do
+ @content.each_chunk_from(nil) { |chunk| chunk.should == '' }
+ end
+
+ # the content is munged so that if it's a checksum nil gets passed in
+ it "when content is a checksum it should try to read from filebucket" do
+ @content.should = "{md5}123abcd"
@content.expects(:read_file_from_filebucket).once.returns('im_a_filebucket')
@content.each_chunk_from(nil) { |chunk| chunk.should == 'im_a_filebucket' }
end