summaryrefslogtreecommitdiff
path: root/spec/unit/run_context_spec.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2014-04-23 14:20:52 -0700
committerdanielsdeleo <dan@getchef.com>2014-04-24 09:49:52 -0700
commit88254d72fd1bfc5c3569537ef9544ac1528b1cea (patch)
tree8ec45ef73423d280333c4252cf92b2d1c1cf24f0 /spec/unit/run_context_spec.rb
parent6d95ac36a84a733a8a0b85632ecf6fc112698d26 (diff)
downloadchef-88254d72fd1bfc5c3569537ef9544ac1528b1cea.tar.gz
Remove classes before redefining to fix warnings.
Diffstat (limited to 'spec/unit/run_context_spec.rb')
-rw-r--r--spec/unit/run_context_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/unit/run_context_spec.rb b/spec/unit/run_context_spec.rb
index 813102527b..1def10faf5 100644
--- a/spec/unit/run_context_spec.rb
+++ b/spec/unit/run_context_spec.rb
@@ -45,6 +45,13 @@ describe Chef::RunContext do
describe "loading cookbooks for a run list" do
before do
+
+ # Each invocation reloads LWRPs, which triggers constant redefinition
+ # warnings. In real usage this isn't an issue because of fork mode.
+ if Chef::Provider.const_defined?(:TestProvider)
+ Chef::Provider.send(:remove_const, :TestProvider)
+ end
+
@node.run_list << "test" << "test::one" << "test::two"
@node.should_receive(:loaded_recipe).with(:test, "default")
@node.should_receive(:loaded_recipe).with(:test, "one")