summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorDavid Schmitt <david.schmitt@puppetlabs.com>2015-06-01 12:21:59 +0100
committerDavid Schmitt <david.schmitt@puppetlabs.com>2015-06-01 12:21:59 +0100
commit65b56c711dc882d7d7f8e26c4e020a6beb297c75 (patch)
treea61b4b6adc220c6a2a1b1295f11b2e1222f90ab1 /spec/spec_helper.rb
parent080d1637f028f8b08221ffd3b7e0ef7aa9eddd73 (diff)
Workaround the broken rspec-mocks support in rspec-puppet
Diffstat (limited to 'spec/spec_helper.rb')
-rwxr-xr-xspec/spec_helper.rb10
1 files changed, 10 insertions, 0 deletions
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