From 5ed59a78f28cce1d6a8f86e1ba7296846edd7a3f Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Fri, 4 May 2018 17:47:44 -0700 Subject: Test for using a provider class. Signed-off-by: Noah Kantrowitz --- spec/unit/node_map_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/unit/node_map_spec.rb') 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 -- cgit v1.2.1