Sha256: cb9038e6a67ef60492366a26c4548b227c2854e42ac40fd445e2e31d31236e4c

Contents?: true

Size: 763 Bytes

Versions: 36

Compression:

Stored size: 763 Bytes

Contents

require 'spec_helper'

describe "the 'fail' parser function" do
  before :all do
    Puppet::Parser::Functions.autoloader.loadall
  end

  let :scope do
    node     = Puppet::Node.new('localhost')
    compiler = Puppet::Parser::Compiler.new(node)
    scope    = Puppet::Parser::Scope.new(compiler)
    allow(scope).to receive(:environment).and_return(nil)
    scope
  end

  it "should exist" do
    expect(Puppet::Parser::Functions.function(:fail)).to eq("function_fail")
  end

  it "should raise a parse error if invoked" do
    expect { scope.function_fail([]) }.to raise_error Puppet::ParseError
  end

  it "should join arguments into a string in the error" do
    expect { scope.function_fail(["hello", "world"]) }.to raise_error(/hello world/)
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
puppet-5.5.22 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.22-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.22-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.22-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-5.5.21 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.21-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.21-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.21-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-5.5.20 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.20-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.20-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.20-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-5.5.19 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.19-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.19-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.19-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-5.5.18 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.18-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.18-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.18-universal-darwin spec/unit/parser/functions/fail_spec.rb