diff options
author | Thom May <thom@chef.io> | 2016-01-18 15:14:54 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2016-01-18 15:14:54 +0000 |
commit | 832505aaa7e029ad76287c1d37c1ebc146869dd4 (patch) | |
tree | b254006a56d4eb042dbaa429804bfd791ae3ebbd /spec/unit/json_compat_spec.rb | |
parent | 0ef0ab07531ae78cb4052242037227b0fb5365dc (diff) | |
download | chef-832505aaa7e029ad76287c1d37c1ebc146869dd4.tar.gz |
ensure unit tests are correct
Diffstat (limited to 'spec/unit/json_compat_spec.rb')
-rw-r--r-- | spec/unit/json_compat_spec.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/unit/json_compat_spec.rb b/spec/unit/json_compat_spec.rb index 524b71f09a..042ac09069 100644 --- a/spec/unit/json_compat_spec.rb +++ b/spec/unit/json_compat_spec.rb @@ -20,10 +20,17 @@ require File.expand_path("../../spec_helper", __FILE__) require "chef/json_compat" describe Chef::JSONCompat do + before { Chef::Config[:treat_deprecation_warnings_as_errors] = false } describe "#from_json with JSON containing an existing class" do let(:json) { '{"json_class": "Chef::Role"}' } + it "emits a deprecation warning" do + Chef::Config[:treat_deprecation_warnings_as_errors] = true + expect { Chef::JSONCompat.from_json(json) }.to raise_error Chef::Exceptions::DeprecatedFeatureError, + /Auto inflation of JSON data is deprecated. Please use Chef::Role#from_hash/ + end + it "returns an instance of the class instead of a Hash" do expect(Chef::JSONCompat.from_json(json).class).to eq Chef::Role end |