Sha256: 5b129ebd923972a50f242cc64ecf248755fa0c2c2778fba64771b6be72240f08

Contents?: true

Size: 887 Bytes

Versions: 8

Compression:

Stored size: 887 Bytes

Contents

require 'spec_helper'

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

  before :each do
    Puppet[:hiera_config] = PuppetSpec::Files.tmpfile('hiera_config')
  end

  it 'should require a key argument' do
    expect { scope.function_hiera_include([]) }.to raise_error(ArgumentError)
  end

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

  it 'should use the array resolution_type' do
    HieraPuppet.expects(:lookup).with() { |*args| args[4].should be :array }.returns(['someclass'])
    expect { scope.function_hiera_include(['key']) }.to raise_error Puppet::Error, /Could not find class someclass/
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
puppet-3.2.4 spec/unit/parser/functions/hiera_include_spec.rb
puppet-3.2.3 spec/unit/parser/functions/hiera_include_spec.rb
puppet-3.2.3.rc1 spec/unit/parser/functions/hiera_include_spec.rb
puppet-3.2.2 spec/unit/parser/functions/hiera_include_spec.rb
puppet-3.2.1 spec/unit/parser/functions/hiera_include_spec.rb
puppet-3.2.1.rc1 spec/unit/parser/functions/hiera_include_spec.rb
puppet-3.2.0.rc2 spec/unit/parser/functions/hiera_include_spec.rb
puppet-3.2.0.rc1 spec/unit/parser/functions/hiera_include_spec.rb