]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
(#13439) refactor spec helper for compatibility with both puppet 2.7 and
authorcprice <chris@puppetlabs.com>
Tue, 27 Mar 2012 17:38:38 +0000 (10:38 -0700)
committerJeff McCune <jeff@puppetlabs.com>
Thu, 29 Mar 2012 23:25:09 +0000 (16:25 -0700)
master

spec/spec_helper.rb

index 87aac34075835c33515ee4e215234b8f6dba9fd4..d6837a98264e0f567060e21f1aafd8385004443a 100644 (file)
@@ -65,22 +65,14 @@ RSpec.configure do |config|
   config.before :each do
     GC.disable
 
-    # these globals are set by Application
-    $puppet_application_mode = nil
-    $puppet_application_name = nil
 
     # REVISIT: I think this conceals other bad tests, but I don't have time to
     # fully diagnose those right now.  When you read this, please come tell me
     # I suck for letting this float. --daniel 2011-04-21
     Signal.stubs(:trap)
 
-    # Set the confdir and vardir to gibberish so that tests
-    # have to be correctly mocked.
-    Puppet[:confdir] = "/dev/null"
-    Puppet[:vardir] = "/dev/null"
+    Puppet.settings.send(:initialize_everything_for_tests)
 
-    # Avoid opening ports to the outside world
-    Puppet.settings[:bindaddress] = "127.0.0.1"
 
     @logs = []
     Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs))
@@ -89,7 +81,7 @@ RSpec.configure do |config|
   end
 
   config.after :each do
-    Puppet.settings.clear
+    Puppet.settings.send(:clear_everything_for_tests)
     Puppet::Node::Environment.clear
     Puppet::Util::Storage.clear
     Puppet::Util::ExecutionStub.reset if Puppet::Util.constants.include? "ExecutionStub"