summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-01-29 14:05:42 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-01-29 14:05:42 -0800
commit652389fbd848861997b9b0c67fae7b2f5ecef064 (patch)
tree7cdde53b9b00b965052b2d4d9786768c003d47a6 /spec/spec_helper.rb
parent0fb2730a4c77264d6d5267eb3261f2912a25791f (diff)
downloadchef-652389fbd848861997b9b0c67fae7b2f5ecef064.tar.gz
fix rspec_reset problem
follows the pattern in the rspec-mocks spec tests of defining a helper module: https://github.com/rspec/rspec-mocks/blob/cee433c89125a3984df33c87eb61985613adce9b/spec/spec_helper.rb
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 9114c35eaf..3bae699cae 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -86,6 +86,15 @@ Dir["spec/support/**/*.rb"].
map { |f| f.gsub(%r[spec/], '')}.
each { |f| require f }
+module VerifyAndResetHelpers
+ def verify(object)
+ RSpec::Mocks.proxy_for(object).verify
+ end
+
+ def reset(object)
+ RSpec::Mocks.proxy_for(object).reset
+ end
+end
OHAI_SYSTEM = Ohai::System.new
OHAI_SYSTEM.require_plugin("os")
@@ -150,6 +159,8 @@ RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.treat_symbols_as_metadata_keys_with_true_values = true
+ config.include VerifyAndResetHelpers
+
config.before(:each) do
Chef::Config.reset
end