diff options
author | danielsdeleo <dan@opscode.com> | 2013-05-27 11:15:01 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-05-29 11:32:22 -0700 |
commit | ca4cd1f830fae2fac3e2c18bbd2693b0caddcb33 (patch) | |
tree | 705a53ee2a2fd379096a8a15ebd6c070a7667639 /spec/unit/mixin | |
parent | 00de51bb552ea2e613afec4825277b855775b71e (diff) | |
download | chef-ca4cd1f830fae2fac3e2c18bbd2693b0caddcb33.tar.gz |
Pass template extensions through to partials
- move the new TemplateContext code into mixin/template and consolidate
with ChefContext
- Copy extension modules from parent template to partial template.
- Functional tests for helpers with partials.
Diffstat (limited to 'spec/unit/mixin')
-rw-r--r-- | spec/unit/mixin/template_spec.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/spec/unit/mixin/template_spec.rb b/spec/unit/mixin/template_spec.rb index bded4a697c..1fc2265ee0 100644 --- a/spec/unit/mixin/template_spec.rb +++ b/spec/unit/mixin/template_spec.rb @@ -24,16 +24,19 @@ describe Chef::Mixin::Template, "render_template" do before :each do @template = TinyTemplateClass.new + @context = Chef::Mixin::Template::TemplateContext.new({}) end it "should render the template evaluated in the given context" do - @template.render_template("<%= @foo %>", { :foo => "bar" }) do |tmp| + @context[:foo] = "bar" + @template.render_template("<%= @foo %>", @context) do |tmp| tmp.open.read.should == "bar" end end it "should provide a node method to access @node" do - @template.render_template("<%= node %>",{:node => "tehShizzle"}) do |tmp| + @context[:node] = "tehShizzle" + @template.render_template("<%= node %>", @context) do |tmp| tmp.open.read.should == "tehShizzle" end end @@ -64,7 +67,7 @@ describe Chef::Mixin::Template, "render_template" do @content_provider = Chef::Provider::Template::Content.new(@resource, @current_resource, @run_context) - @template_context = {} + @template_context = Chef::Mixin::Template::TemplateContext.new({}) @template_context[:node] = @node @template_context[:template_finder] = Chef::Provider::TemplateFinder.new(@run_context, @resource.cookbook_name, @node) end |