summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-06-14 19:06:45 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-14 19:06:45 -0700
commitd67c911268263c710b79cb1bcf8c720d270deb8b (patch)
tree8224f5385f38f5dc98442b67dc1160d4ffb26e80 /spec
parente771309797f70ac5c37ba70c739db47902056513 (diff)
downloadchef-d67c911268263c710b79cb1bcf8c720d270deb8b.tar.gz
Switch map collisions to a dedicated deprecation type so they can be silenced easily.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/node_map_spec.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb
index 7e4980219a..253486438b 100644
--- a/spec/unit/node_map_spec.rb
+++ b/spec/unit/node_map_spec.rb
@@ -213,7 +213,7 @@ describe Chef::NodeMap do
describe "locked mode" do
context "while unlocked" do
it "allows setting the same key twice" do
- expect(Chef).to_not receive(:log_deprecation)
+ expect(Chef).to_not receive(:deprecated)
node_map.set(:foo, FooResource)
node_map.set(:foo, BarResource)
expect(node_map.get(node, :foo)).to eql(BarResource)
@@ -223,7 +223,7 @@ describe Chef::NodeMap do
context "while locked" do
# Uncomment the commented `expect`s in 15.0.
it "rejects setting the same key twice" do
- expect(Chef).to receive(:log_deprecation).with("Trying to register resource foo on top of existing Chef core resource. Check if a new version of the cookbook is available.")
+ expect(Chef).to receive(:deprecated).with(:map_collision, /resource foo/)
node_map.set(:foo, FooResource)
node_map.lock!
node_map.set(:foo, BarResource)
@@ -231,7 +231,7 @@ describe Chef::NodeMap do
end
it "allows setting the same key twice when the first has allow_cookbook_override" do
- expect(Chef).to_not receive(:log_deprecation)
+ expect(Chef).to_not receive(:deprecated)
node_map.set(:foo, FooResource, allow_cookbook_override: true)
node_map.lock!
node_map.set(:foo, BarResource)
@@ -239,7 +239,7 @@ describe Chef::NodeMap do
end
it "allows setting the same key twice when the first has allow_cookbook_override with a future version" do
- expect(Chef).to_not receive(:log_deprecation)
+ expect(Chef).to_not receive(:deprecated)
node_map.set(:foo, FooResource, allow_cookbook_override: "< 100")
node_map.lock!
node_map.set(:foo, BarResource)
@@ -247,7 +247,7 @@ describe Chef::NodeMap do
end
it "rejects setting the same key twice when the first has allow_cookbook_override with a past version" do
- expect(Chef).to receive(:log_deprecation).with("Trying to register resource foo on top of existing Chef core resource. Check if a new version of the cookbook is available.")
+ expect(Chef).to receive(:deprecated).with(:map_collision, /resource foo/)
node_map.set(:foo, FooResource, allow_cookbook_override: "< 1")
node_map.lock!
node_map.set(:foo, BarResource)
@@ -255,7 +255,7 @@ describe Chef::NodeMap do
end
it "allows setting the same key twice when the second has __core_override__" do
- expect(Chef).to_not receive(:log_deprecation)
+ expect(Chef).to_not receive(:deprecated)
node_map.set(:foo, FooResource)
node_map.lock!
node_map.set(:foo, BarResource, __core_override__: true)
@@ -263,7 +263,7 @@ describe Chef::NodeMap do
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.")
+ expect(Chef).to receive(:deprecated).with(:map_collision, /provider foo/)
node_map.set(:foo, FooProvider)
node_map.lock!
node_map.set(:foo, BarProvider)