Sha256: 54c404a091a78428ffd70b07f192959246b966cb4913c83abb1dcf9e4ad7070d

Contents?: true

Size: 768 Bytes

Versions: 198

Compression:

Stored size: 768 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

198 entries across 198 versions & 1 rubygems

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