summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-06-14 19:38:31 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-14 19:39:59 -0700
commit67530a948eba39ea809ed2e869cec2436f389c89 (patch)
tree2a569faa3e14e845f156112fd981b72ab9407ca2 /spec
parent631d79e736ee5ab7001dbbbfcc1a3ffc8f96b052 (diff)
downloadchef-67530a948eba39ea809ed2e869cec2436f389c89.tar.gz
Allow targeting via the deprecation ID, either as a number or in the CHEF-n form we show in various places.
This is because users might not actually know the deprecation key, so this is probably more approachable. Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/chef_class_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/unit/chef_class_spec.rb b/spec/unit/chef_class_spec.rb
index b6d28e7215..f9ea00090e 100644
--- a/spec/unit/chef_class_spec.rb
+++ b/spec/unit/chef_class_spec.rb
@@ -134,6 +134,33 @@ describe "Chef class" do
Chef.deprecated(:generic, "This is my handle.")
end
+ it "allows silencing specific IDs" do
+ Chef::Config[:silence_deprecation_warnings] = [0]
+ expect(Chef::Log).to receive(:warn).with(/I'm a little teapot/).once
+ expect(Chef::Log).to receive(:warn).with(/This is my handle/).once
+ Chef.deprecated(:generic, "I'm a little teapot.")
+ Chef.deprecated(:internal_api, "Short and stout.")
+ Chef.deprecated(:generic, "This is my handle.")
+ end
+
+ it "allows silencing specific IDs using the CHEF- syntax" do
+ Chef::Config[:silence_deprecation_warnings] = ["CHEF-0"]
+ expect(Chef::Log).to receive(:warn).with(/I'm a little teapot/).once
+ expect(Chef::Log).to receive(:warn).with(/This is my handle/).once
+ Chef.deprecated(:generic, "I'm a little teapot.")
+ Chef.deprecated(:internal_api, "Short and stout.")
+ Chef.deprecated(:generic, "This is my handle.")
+ end
+
+ it "allows silencing specific IDs using the chef- syntax" do
+ Chef::Config[:silence_deprecation_warnings] = ["chef-0"]
+ expect(Chef::Log).to receive(:warn).with(/I'm a little teapot/).once
+ expect(Chef::Log).to receive(:warn).with(/This is my handle/).once
+ Chef.deprecated(:generic, "I'm a little teapot.")
+ Chef.deprecated(:internal_api, "Short and stout.")
+ Chef.deprecated(:generic, "This is my handle.")
+ end
+
it "allows silencing specific lines" do
Chef::Config[:silence_deprecation_warnings] = ["chef_class_spec.rb:#{__LINE__ + 4}"]
expect(Chef::Log).to receive(:warn).with(/I'm a little teapot/).once