summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-06-14 18:52:41 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-14 18:52:41 -0700
commit9305d75f4c17aa09ddf7388c0ba53d1c57490258 (patch)
tree990d46ee5a4c43a699d9f3cf0ca23661d7842738
parentc2279033f3cb1134a83e2cc9529351fd4e588f6f (diff)
downloadchef-9305d75f4c17aa09ddf7388c0ba53d1c57490258.tar.gz
Clean up some existing tests for the new API.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r--spec/unit/deprecated_spec.rb19
1 files changed, 7 insertions, 12 deletions
diff --git a/spec/unit/deprecated_spec.rb b/spec/unit/deprecated_spec.rb
index 4eba764b63..6b52c30032 100644
--- a/spec/unit/deprecated_spec.rb
+++ b/spec/unit/deprecated_spec.rb
@@ -20,40 +20,35 @@ require "chef/deprecated"
describe Chef::Deprecated do
class TestDeprecation < Chef::Deprecated::Base
- def id; 999; end
-
- def target; "test.html"; end
-
- def link; "#{Chef::Deprecated::Base::BASE_URL}test.html"; end
+ target 999, "test.html"
end
context "loading a deprecation class" do
it "loads the correct class" do
- expect(Chef::Deprecated.create(:test_deprecation)).to be_an_instance_of(TestDeprecation)
+ expect(Chef::Deprecated.create(:test_deprecation, nil, nil)).to be_an_instance_of(TestDeprecation)
end
- it "optionally sets a message" do
- deprecation = Chef::Deprecated.create(:test_deprecation, "A test message")
+ it "sets a message" do
+ deprecation = Chef::Deprecated.create(:test_deprecation, "A test message", nil)
expect(deprecation.message).to eql("A test message")
end
- it "optionally sets the location" do
+ it "sets the location" do
deprecation = Chef::Deprecated.create(:test_deprecation, nil, "A test location")
expect(deprecation.location).to eql("A test location")
end
end
context "formatting deprecation warnings" do
- let(:base_url) { Chef::Deprecated::Base::BASE_URL }
let(:message) { "A test message" }
let(:location) { "the location" }
it "displays the full URL" do
- expect(TestDeprecation.new().url).to eql("#{base_url}test.html")
+ expect(TestDeprecation.new().url).to eql("https://docs.chef.io/deprecations_test.html")
end
it "formats a complete deprecation message" do
- expect(TestDeprecation.new(message, location).inspect).to eql("#{message} (CHEF-999)#{location}.\nhttps://docs.chef.io/deprecations_test.html")
+ expect(TestDeprecation.new(message, location).to_s).to eql("A test message (CHEF-999)the location.\nPlease see https://docs.chef.io/deprecations_test.html for further details and information on how to correct this problem.")
end
end
end