Sha256: 3dc66c801efe01191d2a6525fa2cba7a21378bc54abcf01ee22dcba2de3154e5

Contents?: true

Size: 763 Bytes

Versions: 92

Compression:

Stored size: 763 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
    Puppet::Parser::Functions.function(:fail).should == "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

92 entries across 92 versions & 2 rubygems

Version Path
puppet-3.8.7 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.6 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.5 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.4 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.3 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.2 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.1 spec/unit/parser/functions/fail_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/parser/functions/fail_spec.rb