Sha256: b0c40c6331438eed6e41b5f8195191782d199e6373085c11be3bb6ca5551a88e

Contents?: true

Size: 763 Bytes

Versions: 57

Compression:

Stored size: 763 Bytes

Contents

require 'spec_helper'
require 'puppet_spec/scope'

describe 'Puppet::Parser::Functions#hiera' do
  include PuppetSpec::Scope

  let :scope do create_test_scope_for_node('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

57 entries across 57 versions & 1 rubygems

Version Path
puppet-3.6.2-x86-mingw32 spec/unit/parser/functions/hiera_spec.rb
puppet-3.6.1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.6.1-x86-mingw32 spec/unit/parser/functions/hiera_spec.rb
puppet-3.6.0 spec/unit/parser/functions/hiera_spec.rb
puppet-3.6.0-x86-mingw32 spec/unit/parser/functions/hiera_spec.rb
puppet-3.6.0.rc1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.6.0.rc1-x86-mingw32 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.1-x86-mingw32 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.1.rc1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.1.rc1-x86-mingw32 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.0.rc3 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.0.rc3-x86-mingw32 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.0.rc2 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.0.rc2-x86-mingw32 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.0.rc1 spec/unit/parser/functions/hiera_spec.rb
puppet-3.5.0.rc1-x86-mingw32 spec/unit/parser/functions/hiera_spec.rb