diff options
author | danielsdeleo <dan@opscode.com> | 2013-06-14 16:20:40 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-06-14 17:11:22 -0700 |
commit | 8eb66a3463bb58a96b68dc156551f5772264b725 (patch) | |
tree | 0355d13fa8d3625d0b32dbce706e0486ca62d54b /spec/unit/mixin/template_spec.rb | |
parent | 51d8059bd067f1a67361db3705648e4394c85d84 (diff) | |
download | chef-8eb66a3463bb58a96b68dc156551f5772264b725.tar.gz |
don't depend on line separator in partial tests
In some windows testing environments no line separator conversion is
happening. This may be a function of git settings, or something else in
our test cluster environment. In any case, line separators are
irrelevant to these tests, as they are testing the partial template
feature. We could remove the line endings from the test fixture files,
but editors like vim add hidden newlines at the end of files, so this is
difficult to maintain. Stripping the line endings within the test code
is more sustainable option.
Diffstat (limited to 'spec/unit/mixin/template_spec.rb')
-rw-r--r-- | spec/unit/mixin/template_spec.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/unit/mixin/template_spec.rb b/spec/unit/mixin/template_spec.rb index 887c21169a..039bc1984f 100644 --- a/spec/unit/mixin/template_spec.rb +++ b/spec/unit/mixin/template_spec.rb @@ -65,8 +65,8 @@ describe Chef::Mixin::Template, "render_template" do end it "should provide a render method" do - output = @template_context.render_template_from_string("before {<%= render 'test.erb' %>} after") - output.should == "before {We could be diving for pearls!#{sep}} after" + output = @template_context.render_template_from_string("before {<%= render('test.erb').strip -%>} after") + output.should == "before {We could be diving for pearls!} after" end it "should render local files" do @@ -85,8 +85,8 @@ describe Chef::Mixin::Template, "render_template" do it "should render partials from a different cookbook" do @template_context[:template_finder] = Chef::Provider::TemplateFinder.new(@run_context, 'apache2', @node) - output = @template_context.render_template_from_string("before {<%= render 'test.erb', :cookbook => 'openldap' %>} after") - output.should == "before {We could be diving for pearls!#{sep}} after" + output = @template_context.render_template_from_string("before {<%= render('test.erb', :cookbook => 'openldap').strip %>} after") + output.should == "before {We could be diving for pearls!} after" end it "should render using the source argument if provided" do @@ -139,8 +139,8 @@ describe Chef::Mixin::Template, "render_template" do it "should render nested partials" do path = File.expand_path(File.join(CHEF_SPEC_DATA, "partial_one.erb")) - output = @template_context.render_template_from_string("before {<%= render '#{path}', :local => true %>} after") - output.should == "before {partial one We could be diving for pearls!#{sep} calling home#{sep}} after" + output = @template_context.render_template_from_string("before {<%= render('#{path}', :local => true).strip %>} after") + output.should == "before {partial one We could be diving for pearls! calling home} after" end describe "when customizing the template context" do |