Sha256: f6c29e49a1790a4e04fc992487c528bc56384c2e961772098d4e8620c577ac8c

Contents?: true

Size: 769 Bytes

Versions: 36

Compression:

Stored size: 769 Bytes

Contents

#! /usr/bin/env ruby
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)
    scope.stubs(:environment).returns(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.12 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.12-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-5.5.10 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.10-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.10-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.10-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-5.5.8 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.8-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.8-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.8-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-5.5.7 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.7-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.7-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.7-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-5.5.6 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.6-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.6-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-5.5.6-universal-darwin spec/unit/parser/functions/fail_spec.rb