From 8f02d027d7ebd7167827cf5ca8318914e3417ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Can=C3=A9vet?= Date: Fri, 18 Apr 2014 14:39:01 +0200 Subject: Update spec_helper.rb --- spec/spec_helper.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'spec') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4edc964..3a125ee 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,3 +2,26 @@ require 'mocha' require 'rspec-puppet' require 'puppetlabs_spec_helper/module_spec_helper' +RSpec.configure do |c| + c.include PuppetlabsSpec::Files + + c.before :each do + # Ensure that we don't accidentally cache facts and environment + # between test cases. + Facter::Util::Loader.any_instance.stubs(:load_all) + Facter.clear + Facter.clear_messages + + # Store any environment variables away to be restored later + @old_env = {} + ENV.each_key {|k| @old_env[k] = ENV[k]} + + if ENV['STRICT_VARIABLES'] == 'yes' + Puppet.settings[:strict_variables]=true + end + end + + c.after :each do + PuppetlabsSpec::Files.cleanup + end +end -- cgit v1.2.3