puppetlabs/puppet — pull request #1747 by carlossg (2013-07-03 18:05:21+00:00)
Title: Accept hiera configuration as Hash for easy rspec hiera data stubbing

Hiera already accepts config Hash (see https://github.com/puppetlabs/hiera/blob/master/lib/hiera/config.rb#L33)

Allows overriding the configuration in rspec tests easily using @mthibaut https://github.com/mthibaut/hiera-puppet-helper rspec backend and some configuration like

Puppet[:hiera_config] = {
:backends=>['rspec'],
:rspec=> respond_to?(:hiera_data) ? hiera_data : {} }

and

let(:hiera_data) {{'myvar' => 'myvalue'}}