Skip to content

Commit

Permalink
cleanup rspec hiera config in hopes travis approves
Browse files Browse the repository at this point in the history
  • Loading branch information
Garrett Rowell authored and Garrett Rowell committed Oct 8, 2015
1 parent d7c906e commit 8947c5f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 28 deletions.
2 changes: 0 additions & 2 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@


describe 'cacti' do
include_context 'hieradata'

context 'supported operating systems' do
describe "cacti class without any parameters on RHEL 7" do
let(:params) {{ }}
Expand Down
8 changes: 8 additions & 0 deletions spec/fixtures/hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
:backends:
- yaml
:yaml:
:datadir: './spec/fixtures/hiera'
:hierarchy:
- '%{::clientcert}'
- 'cacti_data'
27 changes: 1 addition & 26 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,36 +1,11 @@
require 'rubygems'
require 'puppetlabs_spec_helper/module_spec_helper'
require 'hiera'
require 'puppet/indirector/hiera'
require 'hiera-puppet-helper'

#hiera helper
def hiera_stub
config = Hiera::Config.load(hiera_config)
config[:logger] = 'puppet'
Hiera.new(:config => config)
end

RSpec.configure do |config|
config.mock_framework = :rspec

config.mock_with :rspec do |c|
c.syntax = [:should, :expect]
end

#hiera helper
config.before(:each) do
Puppet::Indirector::Hiera.stub(:hiera => hiera_stub)
end

end

shared_context "hieradata" do
let(:hiera_config) do
{ :backends => ['rspec', 'yaml'],
:hierarchy => ['cacti_data'],
:yaml => {
:datadir => File.expand_path(File.join(__FILE__, '..', '..', 'spec/fixtures/hiera')) },
:rspec => respond_to?(:hiera_data) ? hiera_data : {} }
end
config.hiera_config = File.expand_path(File.join(__FILE__, '../fixtures/hiera.yaml'))
end

0 comments on commit 8947c5f

Please sign in to comment.