summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-05-04 17:47:44 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-05 20:25:11 -0700
commit5ed59a78f28cce1d6a8f86e1ba7296846edd7a3f (patch)
tree5b373bee7fc9a478c6635adb648c9a63cd5745ae
parent507da22ccbd821a437ca33a7d4fb1eb42966c471 (diff)
downloadchef-5ed59a78f28cce1d6a8f86e1ba7296846edd7a3f.tar.gz
Test for using a provider class.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r--spec/unit/node_map_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb
index d25bf871fe..ab29a839e8 100644
--- a/spec/unit/node_map_spec.rb
+++ b/spec/unit/node_map_spec.rb
@@ -261,6 +261,14 @@ describe Chef::NodeMap do
node_map.set(:foo, BarResource, __core_override__: true)
expect(node_map.get(node, :foo)).to eql(BarResource)
end
+
+ it "rejects setting the same key twice for a provider" do
+ expect(Chef).to receive(:log_deprecation).with("Trying to register provider foo on top of existing Chef core provider. Check if a new version of the cookbook is available.")
+ node_map.set(:foo, FooProvider)
+ node_map.lock!
+ node_map.set(:foo, BarProvider)
+ # expect(node_map.get(node, :foo)).to eql(FooProvider)
+ end
end
end