No commit activity in last 3 years
No release in over 3 years
Rspec backend for hiera
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

hiera-backend-rspec

Gem Version travis-ci Code Climate Test Coverage

This gem provides a hiera backend for setting up hiera data in tests. At the time if this writing, hiera-backend-rspec is meant to interface with Hiera version 3.2.0.

Installation

Add this line to your application's Gemfile:

gem 'hiera-backend-rspec'

And then run:

$ bundle install

Alternatively, if you wish to just use the gem in a script, you can run:

$ gem install hiera-backend-rspec

Finally, just add require 'hiera-backend-rspec' to the top of the file using this gem.

Usage

Put this into your spec_helper.rb:

RSpec.configure do |c|
  c.before(:each) do
    Thread.current[:rspec_hiera_data] = hiera_data if respond_to?(:hiera_data)
  end
    
  c.after(:each) do
    Thread.current[:rspec_hiera_data] = nil
  end
end

In your specs you can now set up simple hiera data.

let(:hiera_data) do
  {
      'hiera::key' => 'value'
  }
end

Contributing

Please fork and send pull request. Make sure to have test cases for your changes.

License

This program is licensed under the MIT license. See LICENSE for details.