summaryrefslogtreecommitdiff
path: root/spec/unit/mixin/template_spec.rb
diff options
context:
space:
mode:
authorAndrea Campi <andrea.campi@zephirworks.com>2012-11-18 23:38:18 +0100
committerBryan McLellan <btm@opscode.com>2012-12-14 11:10:28 -0800
commitb8cd17a7e9a2f5e9738400b96df478bab093c7e7 (patch)
tree0ef1686aab19958765ef0242088b74eb9675880d /spec/unit/mixin/template_spec.rb
parent77dda3749fb48f0ac4ee3693e21ca0b453c0bbd1 (diff)
downloadchef-b8cd17a7e9a2f5e9738400b96df478bab093c7e7.tar.gz
[CHEF-3249] Accept an optional 'source' option to override the actual path to the partial.
This is mostly for uniformity with the template resource.
Diffstat (limited to 'spec/unit/mixin/template_spec.rb')
-rw-r--r--spec/unit/mixin/template_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/mixin/template_spec.rb b/spec/unit/mixin/template_spec.rb
index a926b1c494..4b8bcb219f 100644
--- a/spec/unit/mixin/template_spec.rb
+++ b/spec/unit/mixin/template_spec.rb
@@ -100,6 +100,20 @@ describe Chef::Mixin::Template, "render_template" do
end
end
+ it "should render using the source argument if provided" do
+ begin
+ tf = Tempfile.new("partial")
+ tf.puts "test"
+ tf.rewind
+
+ @provider.render_template("before {<%= render 'something', :local => true, :source => '#{tf.path}' %>} after", @template_context) do |tmp|
+ tmp.open.read.should == "before {test\n} after"
+ end
+ ensure
+ tf.close
+ end
+ end
+
it "should pass the node to partials" do
@node.normal[:slappiness] = "happiness"