]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Workaround the broken rspec-mocks support in rspec-puppet
authorDavid Schmitt <david.schmitt@puppetlabs.com>
Mon, 1 Jun 2015 11:21:59 +0000 (12:21 +0100)
committerDavid Schmitt <david.schmitt@puppetlabs.com>
Mon, 1 Jun 2015 11:21:59 +0000 (12:21 +0100)
spec/spec_helper.rb

index 896cb83ca00b100380738135f78e8e9e9b66ce49..ccc4d95722df441c0002cb415b05a8a9be5805f2 100755 (executable)
@@ -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