From 65b56c711dc882d7d7f8e26c4e020a6beb297c75 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Mon, 1 Jun 2015 12:21:59 +0100 Subject: Workaround the broken rspec-mocks support in rspec-puppet --- spec/spec_helper.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/spec_helper.rb') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 896cb83..ccc4d95 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,6 +19,9 @@ require 'puppet_spec/database' require 'monkey_patches/alias_should_to_must' require 'mocha/api' +# hack to enable all the expect syntax (like allow_any_instance_of) in rspec-puppet examples +RSpec::Mocks::Syntax.enable_expect(RSpec::Puppet::ManifestMatchers) + RSpec.configure do |config| config.before :each do # Ensure that we don't accidentally cache facts and environment between @@ -29,5 +32,12 @@ RSpec.configure do |config| Facter.clear_messages Puppet[:parser] = 'future' if ENV['FUTURE_PARSER'] == 'yes' + + RSpec::Mocks.setup + end + + config.after :each do + RSpec::Mocks.verify + RSpec::Mocks.teardown end end -- cgit v1.2.3