summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMickaël Canévet <mickael.canevet@camptocamp.com>2014-04-18 14:39:01 +0200
committerMickaël Canévet <mickael.canevet@camptocamp.com>2014-04-18 14:39:01 +0200
commit8f02d027d7ebd7167827cf5ca8318914e3417ef8 (patch)
treef0a23f0f9af8b220ee891254b0df3501d8423bdb /spec
parenta6d8dd515489730863341e6d5610bcbe7d7ce97d (diff)
Update spec_helper.rb
Diffstat (limited to 'spec')
-rw-r--r--spec/spec_helper.rb23
1 files changed, 23 insertions, 0 deletions
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