Sha256: 9db53ddb1c3721b2b4be6ba788379ca0cef0e4f5c9badd99d8a0d8b94e1e7bed

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

#! /usr/bin/env ruby -S rspec

require 'spec_helper'

describe 'Puppet::Parser::Functions#hiera' do
  let :scope do Puppet::Parser::Scope.new_for_test_harness('foo') end

  it 'should require a key argument' do
    expect { scope.function_hiera([]) }.to raise_error(Puppet::ParseError)
  end

  it 'should raise a useful error when nil is returned' do
    Hiera.any_instance.expects(:lookup).returns(nil)
    expect { scope.function_hiera(["badkey"]) }.to raise_error(Puppet::ParseError, /Could not find data item badkey/ )
  end

  it 'should use the priority resolution_type' do
    Hiera.any_instance.expects(:lookup).with() { |*args| args[4].should be :priority }.returns('foo_result')
    scope.function_hiera(['key']).should == 'foo_result'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-3.0.0.rc8 spec/unit/parser/functions/hiera_spec.rb
puppet-3.0.0.rc7 spec/unit/parser/functions/hiera_spec.rb