diff options
author | Jeff McCune <jeff@puppetlabs.com> | 2011-10-10 12:02:34 -0700 |
---|---|---|
committer | Jeff McCune <jeff@puppetlabs.com> | 2011-10-10 12:02:34 -0700 |
commit | 01335cb8dd9b569e6881a5f0e9894378b683f260 (patch) | |
tree | 5e56ddb10819b8fc74b24e5aef2940af7a1be578 /spec/spec_helper.rb | |
parent | 9f98d3feaf7e3fee55bc2b7b2e1d8f75b0972672 (diff) | |
parent | cc001095b3b22afd8a887e0c5d2c73e596513c1f (diff) |
Merge pull request #18 from jeffmccune/maint/master/make_tests_run_on_puppet_26
(Maint) Make rspec tests work with Puppet 2.6.4
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fc19cef..87aac34 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -27,6 +27,32 @@ require 'puppet_spec/matchers' require 'monkey_patches/alias_should_to_must' require 'monkey_patches/publicize_methods' +# JJM Hack to make the stdlib tests run in Puppet 2.6 (See puppet commit cf183534) +if not Puppet.constants.include? "Test" then + module Puppet::Test + class LogCollector + def initialize(logs) + @logs = logs + end + + def <<(value) + @logs << value + end + end + end + Puppet::Util::Log.newdesttype :log_collector do + match "Puppet::Test::LogCollector" + + def initialize(messages) + @messages = messages + end + + def handle(msg) + @messages << msg + end + end +end + Pathname.glob("#{dir}/shared_behaviours/**/*.rb") do |behaviour| require behaviour.relative_path_from(Pathname.new(dir)) end @@ -66,7 +92,7 @@ RSpec.configure do |config| Puppet.settings.clear Puppet::Node::Environment.clear Puppet::Util::Storage.clear - Puppet::Util::ExecutionStub.reset + Puppet::Util::ExecutionStub.reset if Puppet::Util.constants.include? "ExecutionStub" PuppetSpec::Files.cleanup |