Merge branch 'ticket/2.2.x/13439_fix_spec_helper' into 2.2.x

* ticket/2.2.x/13439_fix_spec_helper:
  (#13439) refactor spec helper for compatibility with both puppet 2.7 and master
This commit is contained in:
Jeff McCune 2012-03-29 16:25:55 -07:00
commit cbdffb711f

View 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"