summaryrefslogtreecommitdiff
path: root/spec/unit/cookbook_version_spec.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2015-02-06 15:40:27 -0800
committerdanielsdeleo <dan@getchef.com>2015-02-11 10:52:49 -0800
commita164ceb6cac2808088920e36e35b5e9c16a8496b (patch)
treeb993a8b68ecf2817e800d3c5fd5fb9b39cf84a95 /spec/unit/cookbook_version_spec.rb
parent6c9f246b04c23906dd5297d178a423c96bc7b369 (diff)
downloadchef-a164ceb6cac2808088920e36e35b5e9c16a8496b.tar.gz
Change hard errors to warnings for deprecated methods
Diffstat (limited to 'spec/unit/cookbook_version_spec.rb')
-rw-r--r--spec/unit/cookbook_version_spec.rb39
1 files changed, 38 insertions, 1 deletions
diff --git a/spec/unit/cookbook_version_spec.rb b/spec/unit/cookbook_version_spec.rb
index 95f0d68efc..1a3ec76840 100644
--- a/spec/unit/cookbook_version_spec.rb
+++ b/spec/unit/cookbook_version_spec.rb
@@ -498,7 +498,44 @@ describe Chef::CookbookVersion do
end
end
- pending "These should work when deprecation errors are changed back to warning" do
+
+ describe "when deprecation warnings are errors" do
+
+ subject(:cbv) { Chef::CookbookVersion.new("version validation", '/tmp/blah') }
+
+ it "errors on #save_url" do
+ expect { cbv.save_url }.to raise_error(Chef::Exceptions::DeprecatedFeatureError)
+ end
+
+ it "errors on #force_save_url" do
+ expect { cbv.force_save_url }.to raise_error(Chef::Exceptions::DeprecatedFeatureError)
+ end
+
+ it "errors on #to_hash" do
+ expect { cbv.to_hash }.to raise_error(Chef::Exceptions::DeprecatedFeatureError)
+ end
+
+ it "errors on #to_json" do
+ expect { cbv.to_json }.to raise_error(Chef::Exceptions::DeprecatedFeatureError)
+ end
+
+ end
+
+ describe "deprecated features" do
+
+ subject(:cbv) { Chef::CookbookVersion.new("tatft", '/tmp/blah').tap { |c| c.version = "1.2.3" } }
+
+ before do
+ Chef::Config[:treat_deprecation_warnings_as_errors] = false
+ end
+
+ it "gives a save URL for the standard cookbook API" do
+ expect(cbv.save_url).to eq("cookbooks/tatft/1.2.3")
+ end
+
+ it "gives a force save URL for the standard cookbook API" do
+ expect(cbv.force_save_url).to eq("cookbooks/tatft/1.2.3?force=true")
+ end
include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
let(:jsonable) { Chef::CookbookVersion.new("tatft", '/tmp/blah') }