Sha256: d98a0c25a1d628ef997abf02c43ff4e6918b08c4470510cf9f8059479ba3c7a4

Contents?: true

Size: 721 Bytes

Versions: 22

Compression:

Stored size: 721 Bytes

Contents

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

22 entries across 22 versions & 1 rubygems

Version Path
puppet-3.4.3 spec/unit/parser/functions/hiera_spec.rb
puppet-3.4.2 spec/unit/parser/functions/hiera_spec.rb
puppet-3.4.1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.4.0 spec/unit/parser/functions/hiera_spec.rb
puppet-3.4.0.rc2 spec/unit/parser/functions/hiera_spec.rb
puppet-3.4.0.rc1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.3.2 spec/unit/parser/functions/hiera_spec.rb
puppet-3.3.1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.3.1.rc3 spec/unit/parser/functions/hiera_spec.rb
puppet-3.3.1.rc2 spec/unit/parser/functions/hiera_spec.rb
puppet-3.3.1.rc1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.3.0 spec/unit/parser/functions/hiera_spec.rb
puppet-3.3.0.rc3 spec/unit/parser/functions/hiera_spec.rb
puppet-3.3.0.rc2 spec/unit/parser/functions/hiera_spec.rb
puppet-3.2.4 spec/unit/parser/functions/hiera_spec.rb
puppet-3.2.3 spec/unit/parser/functions/hiera_spec.rb
puppet-3.2.3.rc1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.2.2 spec/unit/parser/functions/hiera_spec.rb
puppet-3.2.1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.2.1.rc1 spec/unit/parser/functions/hiera_spec.rb