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.4.0 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.4.0.rc2 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.4.0.rc1 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.3.2 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.3.1 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.3.1.rc3 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.3.1.rc2 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.3.1.rc1 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.3.0 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.3.0.rc3 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.3.0.rc2 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.2.4 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.2.3 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.2.3.rc1 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.2.2 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.2.1 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.2.1.rc1 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.2.0.rc2 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.2.0.rc1 spec/unit/parser/functions/inline_template_spec.rb
puppet-3.1.1 spec/unit/parser/functions/inline_template_spec.rb