Sha256: 4c39942487e0bdf67010fc125b8c62c073ae720a133a54d35a0d19fb4679f1ed

Contents?: true

Size: 690 Bytes

Versions: 304

Compression:

Stored size: 690 Bytes

Contents

require 'spec_helper'

describe "the 'fail' parser function" do
  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

304 entries across 304 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/unit/parser/functions/fail_spec.rb
puppet-8.3.0-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-8.3.0-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-8.3.0-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-8.4.0 spec/unit/parser/functions/fail_spec.rb
puppet-8.4.0-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-8.4.0-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-8.4.0-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-7.28.0 spec/unit/parser/functions/fail_spec.rb
puppet-7.28.0-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-7.28.0-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-7.28.0-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-8.3.1 spec/unit/parser/functions/fail_spec.rb
puppet-8.3.1-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-8.3.1-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-8.3.1-universal-darwin spec/unit/parser/functions/fail_spec.rb
puppet-7.27.0 spec/unit/parser/functions/fail_spec.rb
puppet-7.27.0-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-7.27.0-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-7.27.0-universal-darwin spec/unit/parser/functions/fail_spec.rb