Sha256: cffaa823c2a17829a8d8375f360eb017524bc4515ceb0ea4377050730aa22770

Contents?: true

Size: 705 Bytes

Versions: 9

Compression:

Stored size: 705 Bytes

Contents

require 'spec_helper'

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

  it 'should require a key argument' do
    expect { scope.function_hiera_hash([]) }.to raise_error(Puppet::ParseError)
  end

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
puppet-3.0.2 spec/unit/parser/functions/hiera_hash_spec.rb
puppet-3.0.2.rc3 spec/unit/parser/functions/hiera_hash_spec.rb
puppet-3.0.2.rc2 spec/unit/parser/functions/hiera_hash_spec.rb
puppet-3.0.2.rc1 spec/unit/parser/functions/hiera_hash_spec.rb
puppet-3.0.1 spec/unit/parser/functions/hiera_hash_spec.rb
puppet-3.0.1.rc1 spec/unit/parser/functions/hiera_hash_spec.rb
puppet-3.0.0 spec/unit/parser/functions/hiera_hash_spec.rb
puppet-3.0.0.rc8 spec/unit/parser/functions/hiera_hash_spec.rb
puppet-3.0.0.rc7 spec/unit/parser/functions/hiera_hash_spec.rb