Sha256: c007545674b42f2627a24cf6cf5abf7d6f3f0c5d8047e08d0f8c0b7ec6ffbd79

Contents?: true

Size: 772 Bytes

Versions: 4

Compression:

Stored size: 772 Bytes

Contents

#! /usr/bin/env ruby -S rspec
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

4 entries across 4 versions & 1 rubygems

Version Path
puppet-3.0.0.rc8 spec/unit/parser/functions/fail_spec.rb
puppet-3.0.0.rc7 spec/unit/parser/functions/fail_spec.rb
puppet-3.0.0.rc5 spec/unit/parser/functions/fail_spec.rb
puppet-3.0.0.rc4 spec/unit/parser/functions/fail_spec.rb