Sha256: ae98eb8f2b88bf456e96ebe09b405a7225a9b6cab466578688a2060f3e8e45a4

Contents?: true

Size: 1.1 KB

Versions: 80

Compression:

Stored size: 1.1 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

describe "the inline_template function" do
  before :all do
    Puppet::Parser::Functions.autoloader.loadall
  end

  let(:node) { Puppet::Node.new('localhost') }
  let(:compiler) { Puppet::Parser::Compiler.new(node) }
  let(:scope) { Puppet::Parser::Scope.new(compiler) }

  it "should concatenate template wrapper outputs for multiple templates" do
    inline_template("template1", "template2").should == "template1template2"
  end

  it "should raise an error if the template raises an error" do
    expect { inline_template("<% raise 'error' %>") }.to raise_error(Puppet::ParseError)
  end

  it "is not interfered with by a variable called 'string' (#14093)" do
    scope['string'] = "this is a variable"
    inline_template("this is a template").should == "this is a template"
  end

  it "has access to a variable called 'string' (#14093)" do
    scope['string'] = "this is a variable"
    inline_template("string was: <%= @string %>").should == "string was: this is a variable"
  end

  def inline_template(*templates)
    scope.function_inline_template(templates)
  end
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.6 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.5 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.4 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.3 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.2 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.1 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb