Sha256: f12d687d078544f4c0150ea8ab016e6e8efdb55b47f6b410ffa7666a0a695131

Contents?: true

Size: 743 Bytes

Versions: 6

Compression:

Stored size: 743 Bytes

Contents

#! /usr/bin/env ruby

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(ArgumentError)
  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

6 entries across 6 versions & 2 rubygems

Version Path
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/parser/functions/hiera_spec.rb
puppet-3.1.1 spec/unit/parser/functions/hiera_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/parser/functions/hiera_spec.rb
puppet-3.1.0 spec/unit/parser/functions/hiera_spec.rb
puppet-3.1.0.rc2 spec/unit/parser/functions/hiera_spec.rb
puppet-3.1.0.rc1 spec/unit/parser/functions/hiera_spec.rb