Skip to content

Commit 8bf9aba

Browse files
committed
Workaround the broken rspec-mocks support in rspec-puppet
1 parent 51b64f1 commit 8bf9aba

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/spec_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ module PuppetSpec
1919
require 'monkey_patches/alias_should_to_must'
2020
require 'mocha/api'
2121

22+
# hack to enable all the expect syntax (like allow_any_instance_of) in rspec-puppet examples
23+
RSpec::Mocks::Syntax.enable_expect(RSpec::Puppet::ManifestMatchers)
24+
2225
RSpec.configure do |config|
2326
config.before :each do
2427
# Ensure that we don't accidentally cache facts and environment between
@@ -29,5 +32,12 @@ module PuppetSpec
2932
Facter.clear_messages
3033

3134
Puppet[:parser] = 'future' if ENV['FUTURE_PARSER'] == 'yes'
35+
36+
RSpec::Mocks.setup
37+
end
38+
39+
config.after :each do
40+
RSpec::Mocks.verify
41+
RSpec::Mocks.teardown
3242
end
3343
end

0 commit comments

Comments
 (0)