Sha256: 3e53fc92b2499b28833f3ef14ad0f828a40efb814938ed524b5a3b94d4e4758a

Contents?: true

Size: 843 Bytes

Versions: 57

Compression:

Stored size: 843 Bytes

Contents

require 'spec_helper'
require 'puppet_spec/scope'

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

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

  let :scope do create_test_scope_for_node('foo') end

  it 'should require a key argument' do
    expect { scope.function_hiera_array([]) }.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_array(["badkey"]) }.to raise_error(Puppet::ParseError, /Could not find data item badkey/ )
  end

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

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.6 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.5 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.4 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.3 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.2 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.1 spec/unit/parser/functions/hiera_array_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/parser/functions/hiera_array_spec.rb