Sha256: d423a05463703e0f18060d7793599637fa5ad6f9ffb03f8373fe01bc8ca9e4ae

Contents?: true

Size: 1.12 KB

Versions: 194

Compression:

Stored size: 1.12 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
    expect(inline_template("template1", "template2")).to eq("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"
    expect(inline_template("this is a template")).to eq("this is a template")
  end

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

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

Version data entries

194 entries across 194 versions & 1 rubygems

Version Path
puppet-5.3.7 spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.7-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.7-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.7-universal-darwin spec/unit/parser/functions/inline_template_spec.rb
puppet-4.10.12 spec/unit/parser/functions/inline_template_spec.rb
puppet-4.10.12-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-4.10.12-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-4.10.12-universal-darwin spec/unit/parser/functions/inline_template_spec.rb
puppet-4.10.11 spec/unit/parser/functions/inline_template_spec.rb
puppet-4.10.11-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-4.10.11-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-4.10.11-universal-darwin spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.6 spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.6-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.6-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.6-universal-darwin spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.5 spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.5-x86-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.5-x64-mingw32 spec/unit/parser/functions/inline_template_spec.rb
puppet-5.3.5-universal-darwin spec/unit/parser/functions/inline_template_spec.rb