summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-10-09 14:21:39 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2014-10-09 14:21:39 -0700
commitcd5a98946e2ad28b4478d372c9df2446000f0415 (patch)
treea443a2068f004f9461b99a9c5660a95eb6c5f7bf
parenta12ce2c412c44cf33c893c1c39fc277c2e73163e (diff)
downloadchef-cd5a98946e2ad28b4478d372c9df2446000f0415.tar.gz
Revert "Merge pull request #2114 from opscode/tball/yajl-replace-json"
This reverts commit 416fe0955671a459243dd3172875239e29f0d654, reversing changes made to 7f236885e421954ba39e6daf0d9da30b16b04040.
-rw-r--r--CHANGELOG.md1
-rw-r--r--DOC_CHANGES.md3
-rw-r--r--Gemfile2
-rw-r--r--chef.gemspec4
-rw-r--r--kitchen-tests/test/fixtures/serverspec_helper.rb3
-rw-r--r--kitchen-tests/test/integration/webapp/serverspec/Gemfile4
-rw-r--r--lib/chef/chef_fs/chef_fs_data_store.rb2
-rw-r--r--lib/chef/chef_fs/command_line.rb2
-rw-r--r--lib/chef/chef_fs/file_system/organization_invites_entry.rb3
-rw-r--r--lib/chef/chef_fs/file_system/organization_members_entry.rb3
-rw-r--r--lib/chef/chef_fs/file_system/rest_list_entry.rb3
-rw-r--r--lib/chef/cookbook_version.rb2
-rw-r--r--lib/chef/json_compat.rb4
-rw-r--r--lib/chef/knife/bootstrap/archlinux-gems.erb4
-rw-r--r--lib/chef/knife/bootstrap/chef-aix.erb4
-rw-r--r--lib/chef/knife/bootstrap/chef-full.erb4
-rw-r--r--lib/chef/util/powershell/cmdlet_result.rb4
-rw-r--r--spec/data/bootstrap/test-hints.erb2
-rw-r--r--spec/data/bootstrap/test.erb2
-rw-r--r--spec/functional/knife/cookbook_delete_spec.rb6
-rw-r--r--spec/functional/knife/exec_spec.rb2
-rw-r--r--spec/functional/util/powershell/cmdlet_spec.rb4
-rw-r--r--spec/integration/knife/upload_spec.rb5
-rw-r--r--spec/spec_helper.rb3
-rw-r--r--spec/support/shared/integration/integration_helper.rb2
-rw-r--r--spec/support/shared/shared_examples.rb14
-rw-r--r--spec/tiny_server.rb3
-rw-r--r--spec/unit/api_client_spec.rb6
-rw-r--r--spec/unit/config_fetcher_spec.rb3
-rw-r--r--spec/unit/cookbook/metadata_spec.rb8
-rw-r--r--spec/unit/cookbook_loader_spec.rb2
-rw-r--r--spec/unit/cookbook_version_spec.rb4
-rw-r--r--spec/unit/data_bag_item_spec.rb6
-rw-r--r--spec/unit/data_bag_spec.rb6
-rw-r--r--spec/unit/encrypted_data_bag_item_spec.rb35
-rw-r--r--spec/unit/environment_spec.rb8
-rw-r--r--spec/unit/exceptions_spec.rb6
-rw-r--r--spec/unit/json_compat_spec.rb14
-rw-r--r--spec/unit/knife/cookbook_site_share_spec.rb8
-rw-r--r--spec/unit/knife/core/bootstrap_context_spec.rb4
-rw-r--r--spec/unit/knife/data_bag_from_file_spec.rb2
-rw-r--r--spec/unit/node_spec.rb7
-rw-r--r--spec/unit/provider/remote_file/cache_control_data_spec.rb2
-rw-r--r--spec/unit/resource_collection_spec.rb12
-rw-r--r--spec/unit/resource_reporter_spec.rb6
-rw-r--r--spec/unit/resource_spec.rb6
-rw-r--r--spec/unit/role_spec.rb4
-rw-r--r--spec/unit/run_list_spec.rb6
-rw-r--r--spec/unit/user_spec.rb6
49 files changed, 82 insertions, 174 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2daf841499..452b1d331b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -146,7 +146,6 @@
* Add escape_glob method to PathHelper, update glob operations.
* Verify x509 properties of certificates in the :trusted_certs_dir during knife ssl check.
* Disable unforked interval chef-client runs.
-* Removed dependencies on the 'json' gem, replaced with ffi-yajl. Use Chef::JSONCompat library for parsing and printing.
## Last Release: 11.14.2
diff --git a/DOC_CHANGES.md b/DOC_CHANGES.md
index 08c343809a..ceccb77cd0 100644
--- a/DOC_CHANGES.md
+++ b/DOC_CHANGES.md
@@ -467,6 +467,7 @@ PathHelper = Chef::Util::PathHelper
Dir.glob(File.join(PathHelper.escape_glob(path), "*")) # ["#{path}\\apache2", "#{path}\\apt", ...]
Dir[PathHelper.escape_glob(path) + "/*"] # ["#{path}\\apache2", "#{path}\\apt", ...]
```
+
## Mac OS X default package provider is now Homebrew
Per [Chef RFC 016](https://github.com/opscode/chef-rfc/blob/master/rfc016-homebrew-osx-package-provider.md), the default provider for the `package` resource on Mac OS X is now [Homebrew](http://brew.sh). The [homebrew cookbook's](https://supermarket.getchef.com/cookbooks/homebrew) default recipe, or some other method is still required for getting homebrew installed on the system. The cookbook won't be strictly required just to install packages from homebrew on OS X, though. To use this, simply use the `package` resource, or the `homebrew_package` shortcut resource:
@@ -520,4 +521,4 @@ end
```
Chef will then execute the Homebrew command as that user. The `homebrew_user` attribute can only be provided to the
-`homebrew_package` resource, not the `package` resource.
+`homebrew_package` resource, not the `package` resource. \ No newline at end of file
diff --git a/Gemfile b/Gemfile
index b298b396e0..1418235ebc 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,8 +2,6 @@ source "https://rubygems.org"
gemspec :name => "chef"
gem "activesupport", "< 4.0.0", :group => :compat_testing, :platform => "ruby"
-# TODO remove this when next version of ffi-yajl is released including this change
-gem "ffi-yajl", :github => 'tyler-ball/ffi-yajl', :branch => 'tball/remove_to_json'
group(:docgen) do
gem "yard"
diff --git a/chef.gemspec b/chef.gemspec
index f970bb32f9..481b120fe6 100644
--- a/chef.gemspec
+++ b/chef.gemspec
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
s.add_dependency "mixlib-shellout", ">= 2.0.0.rc.0", "< 3.0"
s.add_dependency "ohai", ">= 7.6.0.rc.0"
- s.add_dependency "ffi-yajl", "~> 1.1"
+ s.add_dependency "ffi-yajl", "~> 1.0", ">= 1.0.2"
s.add_dependency "net-ssh", "~> 2.6"
s.add_dependency "net-ssh-multi", "~> 1.1"
# CHEF-3027: The knife-cloud plugins require newer features from highline, core chef should not.
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
s.add_dependency "erubis", "~> 2.7"
s.add_dependency "diff-lcs", "~> 1.2", ">= 1.2.4"
- s.add_dependency "chef-zero", "~> 3.2"
+ s.add_dependency "chef-zero", "~> 3.1"
s.add_dependency "pry", "~> 0.9"
s.add_dependency 'plist', '~> 3.1.0'
diff --git a/kitchen-tests/test/fixtures/serverspec_helper.rb b/kitchen-tests/test/fixtures/serverspec_helper.rb
index 48963dc45d..6e6d71e79b 100644
--- a/kitchen-tests/test/fixtures/serverspec_helper.rb
+++ b/kitchen-tests/test/fixtures/serverspec_helper.rb
@@ -4,7 +4,6 @@
require 'serverspec'
require 'json'
-require 'ffi_yajl'
set :backend, :exec
@@ -22,7 +21,7 @@ def load_nodestub
platform = 'centos'
platform_version = os[:release].to_i
end
- FFI_Yajl::Parser.parse(IO.read("#{ENV['BUSSER_ROOT']}/../kitchen/data/platforms/#{platform}/#{platform_version}.json"), :symbolize_names => true)
+ JSON.parse(IO.read("#{ENV['BUSSER_ROOT']}/../kitchen/data/platforms/#{platform}/#{platform_version}.json"), :symbolize_names => true)
end
# centos-59 doesn't have /sbin in the default path,
diff --git a/kitchen-tests/test/integration/webapp/serverspec/Gemfile b/kitchen-tests/test/integration/webapp/serverspec/Gemfile
deleted file mode 100644
index 0cb00ce354..0000000000
--- a/kitchen-tests/test/integration/webapp/serverspec/Gemfile
+++ /dev/null
@@ -1,4 +0,0 @@
-# This Gemfile is only needed so that busser will install gems it needs for serverspec_helper.rb to work
-source "https://rubygems.org"
-
-gem 'ffi-yajl', '~> 1.1' # Go away, JSON gem
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb
index 3813d0edb4..484ab07390 100644
--- a/lib/chef/chef_fs/chef_fs_data_store.rb
+++ b/lib/chef/chef_fs/chef_fs_data_store.rb
@@ -168,7 +168,7 @@ class Chef
end
end
end
- Chef::JSONCompat.to_json_pretty(result)
+ JSON.pretty_generate(result)
else
begin
diff --git a/lib/chef/chef_fs/command_line.rb b/lib/chef/chef_fs/command_line.rb
index 8a205eef78..43e8b276e0 100644
--- a/lib/chef/chef_fs/command_line.rb
+++ b/lib/chef/chef_fs/command_line.rb
@@ -253,7 +253,7 @@ class Chef
def self.canonicalize_json(json_text)
parsed_json = Chef::JSONCompat.parse(json_text)
sorted_json = sort_keys(parsed_json)
- Chef::JSONCompat.to_json_pretty(sorted_json)
+ JSON.pretty_generate(sorted_json)
end
def self.diff_text(old_path, new_path, old_value, new_value)
diff --git a/lib/chef/chef_fs/file_system/organization_invites_entry.rb b/lib/chef/chef_fs/file_system/organization_invites_entry.rb
index 5df37085cb..cb26326050 100644
--- a/lib/chef/chef_fs/file_system/organization_invites_entry.rb
+++ b/lib/chef/chef_fs/file_system/organization_invites_entry.rb
@@ -1,6 +1,5 @@
require 'chef/chef_fs/file_system/rest_list_entry'
require 'chef/chef_fs/data_handler/organization_invites_data_handler'
-require 'chef/json_compat'
class Chef
module ChefFS
@@ -35,7 +34,7 @@ class Chef
end
def write(contents)
- desired_invites = minimize_value(Chef::JSONCompat.parse(contents, :create_additions => false))
+ desired_invites = minimize_value(JSON.parse(contents, :create_additions => false))
actual_invites = _read_json.inject({}) { |h,val| h[val['username']] = val['id']; h }
invites = actual_invites.keys
(desired_invites - invites).each do |invite|
diff --git a/lib/chef/chef_fs/file_system/organization_members_entry.rb b/lib/chef/chef_fs/file_system/organization_members_entry.rb
index 94393b341f..eb524d5ea2 100644
--- a/lib/chef/chef_fs/file_system/organization_members_entry.rb
+++ b/lib/chef/chef_fs/file_system/organization_members_entry.rb
@@ -1,6 +1,5 @@
require 'chef/chef_fs/file_system/rest_list_entry'
require 'chef/chef_fs/data_handler/organization_members_data_handler'
-require 'chef/json_compat'
class Chef
module ChefFS
@@ -35,7 +34,7 @@ class Chef
end
def write(contents)
- desired_members = minimize_value(Chef::JSONCompat.parse(contents, :create_additions => false))
+ desired_members = minimize_value(JSON.parse(contents, :create_additions => false))
members = minimize_value(_read_json)
(desired_members - members).each do |member|
begin
diff --git a/lib/chef/chef_fs/file_system/rest_list_entry.rb b/lib/chef/chef_fs/file_system/rest_list_entry.rb
index f68794cb0d..ac47ff4f25 100644
--- a/lib/chef/chef_fs/file_system/rest_list_entry.rb
+++ b/lib/chef/chef_fs/file_system/rest_list_entry.rb
@@ -21,7 +21,6 @@ require 'chef/chef_fs/file_system/not_found_error'
require 'chef/chef_fs/file_system/operation_failed_error'
require 'chef/role'
require 'chef/node'
-require 'chef/json_compat'
class Chef
module ChefFS
@@ -173,7 +172,7 @@ class Chef
def api_error_text(response)
begin
- Chef::JSONCompat.parse(response.body)['error'].join("\n")
+ JSON.parse(response.body)['error'].join("\n")
rescue
response.body
end
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index 95af94bdf7..40aaaf1191 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -479,7 +479,7 @@ class Chef
cookbook_version.manifest = o
# We don't need the following step when we decide to stop supporting deprecated operators in the metadata (e.g. <<, >>)
- cookbook_version.manifest["metadata"] = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(cookbook_version.metadata))
+ cookbook_version.manifest["metadata"] = Chef::JSONCompat.from_json(cookbook_version.metadata.to_json)
cookbook_version.freeze_version if o["frozen?"]
cookbook_version
diff --git a/lib/chef/json_compat.rb b/lib/chef/json_compat.rb
index 3350da0c13..e92d5c36ae 100644
--- a/lib/chef/json_compat.rb
+++ b/lib/chef/json_compat.rb
@@ -18,9 +18,9 @@
# Wrapper class for interacting with JSON.
require 'ffi_yajl'
-require 'chef/exceptions'
-# We're requiring this to prevent breaking consumers using Hash.to_json
require 'json'
+require 'ffi_yajl/json_gem' # XXX: parts of chef require JSON gem's Hash#to_json monkeypatch
+require 'chef/exceptions'
class Chef
class JSONCompat
diff --git a/lib/chef/knife/bootstrap/archlinux-gems.erb b/lib/chef/knife/bootstrap/archlinux-gems.erb
index 581293daa3..eb134b90d5 100644
--- a/lib/chef/knife/bootstrap/archlinux-gems.erb
+++ b/lib/chef/knife/bootstrap/archlinux-gems.erb
@@ -34,7 +34,7 @@ mkdir -p /etc/chef/ohai/hints
<% @chef_config[:knife][:hints].each do |name, hash| -%>
cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
-<%= Chef::JSONCompat.to_json(hash) %>
+<%= hash.to_json %>
EOP
<% end -%>
<% end -%>
@@ -61,7 +61,7 @@ https_proxy "<%= knife_config[:bootstrap_proxy] %>"
EOP
cat > /etc/chef/first-boot.json <<'EOP'
-<%= Chef::JSONCompat.to_json(first_boot) %>
+<%= first_boot.to_json %>
EOP
<%= start_chef %>'
diff --git a/lib/chef/knife/bootstrap/chef-aix.erb b/lib/chef/knife/bootstrap/chef-aix.erb
index 013ad1decb..3a031ee738 100644
--- a/lib/chef/knife/bootstrap/chef-aix.erb
+++ b/lib/chef/knife/bootstrap/chef-aix.erb
@@ -47,7 +47,7 @@ mkdir -p /etc/chef/ohai/hints
<% @chef_config[:knife][:hints].each do |name, hash| -%>
cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
-<%= Chef::JSONCompat.to_json(hash) %>
+<%= hash.to_json %>
EOP
<% end -%>
<% end -%>
@@ -57,7 +57,7 @@ cat > /etc/chef/client.rb <<'EOP'
EOP
cat > /etc/chef/first-boot.json <<'EOP'
-<%= Chef::JSONCompat.to_json(first_boot) %>
+<%= first_boot.to_json %>
EOP
<%= start_chef %>'
diff --git a/lib/chef/knife/bootstrap/chef-full.erb b/lib/chef/knife/bootstrap/chef-full.erb
index dfd5df0071..6edb485f44 100644
--- a/lib/chef/knife/bootstrap/chef-full.erb
+++ b/lib/chef/knife/bootstrap/chef-full.erb
@@ -61,7 +61,7 @@ mkdir -p /etc/chef/ohai/hints
<% @chef_config[:knife][:hints].each do |name, hash| -%>
cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
-<%= Chef::JSONCompat.to_json(hash) %>
+<%= hash.to_json %>
EOP
<% end -%>
<% end -%>
@@ -71,7 +71,7 @@ cat > /etc/chef/client.rb <<'EOP'
EOP
cat > /etc/chef/first-boot.json <<'EOP'
-<%= Chef::JSONCompat.to_json(first_boot) %>
+<%= first_boot.to_json %>
EOP
echo "Starting first Chef Client run..."
diff --git a/lib/chef/util/powershell/cmdlet_result.rb b/lib/chef/util/powershell/cmdlet_result.rb
index 246701a7bc..af7b3607cd 100644
--- a/lib/chef/util/powershell/cmdlet_result.rb
+++ b/lib/chef/util/powershell/cmdlet_result.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/json_compat'
+require 'json'
class Chef::Util::Powershell
class CmdletResult
@@ -33,7 +33,7 @@ class Chef::Util::Powershell
def return_value
if output_format == :object
- Chef::JSONCompat.parse(@status.stdout)
+ JSON.parse(@status.stdout)
else
@status.stdout
end
diff --git a/spec/data/bootstrap/test-hints.erb b/spec/data/bootstrap/test-hints.erb
index 7693fdc7c9..29ba710b42 100644
--- a/spec/data/bootstrap/test-hints.erb
+++ b/spec/data/bootstrap/test-hints.erb
@@ -6,7 +6,7 @@ mkdir -p /etc/chef/ohai/hints
<% @chef_config[:knife][:hints].each do |name, hash| -%>
(
cat <<'EOP'
-<%= Chef::JSONCompat.to_json(hash) %>
+<%= hash.to_json %>
EOP
) > /etc/chef/ohai/hints/<%= name %>.json
<% end -%>
diff --git a/spec/data/bootstrap/test.erb b/spec/data/bootstrap/test.erb
index 3a383b47d0..7cdc7dfdd0 100644
--- a/spec/data/bootstrap/test.erb
+++ b/spec/data/bootstrap/test.erb
@@ -1 +1 @@
-<%= Chef::JSONCompat.to_json(first_boot) %>
+<%= first_boot.to_json %> \ No newline at end of file
diff --git a/spec/functional/knife/cookbook_delete_spec.rb b/spec/functional/knife/cookbook_delete_spec.rb
index 4773fd2185..ee620bf165 100644
--- a/spec/functional/knife/cookbook_delete_spec.rb
+++ b/spec/functional/knife/cookbook_delete_spec.rb
@@ -47,7 +47,7 @@ describe Chef::Knife::CookbookDelete do
Chef::Log.level = :debug
@knife.name_args = %w{no-such-cookbook}
- @api.get("/cookbooks/no-such-cookbook", 404, Chef::JSONCompat.to_json({'error'=>'dear Tim, no. -Sent from my iPad'}))
+ @api.get("/cookbooks/no-such-cookbook", 404, {'error'=>'dear Tim, no. -Sent from my iPad'}.to_json)
end
it "logs an error and exits" do
@@ -62,7 +62,7 @@ describe Chef::Knife::CookbookDelete do
before do
@knife.name_args = %w{obsolete-cookbook}
@cookbook_list = {'obsolete-cookbook' => { 'versions' => ['version' => '1.0.0']} }
- @api.get("/cookbooks/obsolete-cookbook", 200, Chef::JSONCompat.to_json(@cookbook_list))
+ @api.get("/cookbooks/obsolete-cookbook", 200, @cookbook_list.to_json)
end
it "asks for confirmation, then deletes the cookbook" do
@@ -105,7 +105,7 @@ describe Chef::Knife::CookbookDelete do
versions = ['1.0.0', '1.1.0', '1.2.0']
with_version = lambda { |version| { 'version' => version } }
@cookbook_list = {'obsolete-cookbook' => { 'versions' => versions.map(&with_version) } }
- @api.get("/cookbooks/obsolete-cookbook", 200, Chef::JSONCompat.to_json(@cookbook_list))
+ @api.get("/cookbooks/obsolete-cookbook", 200, @cookbook_list.to_json)
end
it "deletes all versions of a cookbook when given the '-a' flag" do
diff --git a/spec/functional/knife/exec_spec.rb b/spec/functional/knife/exec_spec.rb
index 7eb52d01df..455160fd5c 100644
--- a/spec/functional/knife/exec_spec.rb
+++ b/spec/functional/knife/exec_spec.rb
@@ -47,7 +47,7 @@ describe Chef::Knife::Exec do
@node = Chef::Node.new
@node.name("ohai-world")
response = {"rows" => [@node],"start" => 0,"total" => 1}
- @api.get(%r{^/search/node}, 200, Chef::JSONCompat.to_json(response))
+ @api.get(%r{^/search/node}, 200, response.to_json)
code = "$output.puts nodes.all"
@knife.config[:exec] = code
@knife.run
diff --git a/spec/functional/util/powershell/cmdlet_spec.rb b/spec/functional/util/powershell/cmdlet_spec.rb
index b240a5ec12..63d1ac09b5 100644
--- a/spec/functional/util/powershell/cmdlet_spec.rb
+++ b/spec/functional/util/powershell/cmdlet_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/json_compat'
+require 'json'
require File.expand_path('../../../../spec_helper', __FILE__)
describe Chef::Util::Powershell::Cmdlet, :windows_only do
@@ -91,7 +91,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_only do
it "returns json format data", :windows_powershell_dsc_only do
result = cmdlet_alias_requires_switch_or_argument.run({},{},'ls')
expect(result.succeeded?).to eq(true)
- expect(lambda{Chef::JSONCompat.parse(result.return_value)}).not_to raise_error
+ expect(lambda{JSON.parse(result.return_value)}).not_to raise_error
end
end
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb
index dade476889..1db2f613b3 100644
--- a/spec/integration/knife/upload_spec.rb
+++ b/spec/integration/knife/upload_spec.rb
@@ -19,7 +19,6 @@ require 'support/shared/integration/integration_helper'
require 'chef/knife/upload'
require 'chef/knife/diff'
require 'chef/knife/raw'
-require 'chef/json_compat'
describe 'knife upload', :workstation do
include IntegrationSupport
@@ -262,7 +261,7 @@ Created /data_bags/x/y.json
EOM
knife('diff --name-status /data_bags').should_succeed <<EOM
EOM
- Chef::JSONCompat.parse(knife('raw /data/x/y').stdout, :create_additions => false).keys.sort.should == [ 'foo', 'id' ]
+ JSON.parse(knife('raw /data/x/y').stdout, :create_additions => false).keys.sort.should == [ 'foo', 'id' ]
end
it 'knife upload /data_bags/x /data_bags/x/y.json uploads x once' do
@@ -285,7 +284,7 @@ Created /data_bags/x
Created /data_bags/x/y.json
EOM
knife('diff --name-status /data_bags').should_succeed ''
- result = Chef::JSONCompat.parse(knife('raw /data/x/y').stdout, :create_additions => false)
+ result = JSON.parse(knife('raw /data/x/y').stdout, :create_additions => false)
result.keys.sort.should == [ 'chef_type', 'data_bag', 'id' ]
result['chef_type'].should == 'aaa'
result['data_bag'].should == 'bbb'
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 1760aab871..b68a744f35 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -188,6 +188,3 @@ module WEBrick
end
end
end
-
-# Enough stuff needs json serialization that I'm just adding it here for equality asserts
-require 'chef/json_compat'
diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb
index e6942c62af..b42f7f69d9 100644
--- a/spec/support/shared/integration/integration_helper.rb
+++ b/spec/support/shared/integration/integration_helper.rb
@@ -72,7 +72,7 @@ module IntegrationSupport
File.open(filename, 'w') do |file|
raw = case contents
when Hash, Array
- Chef::JSONCompat.to_json_pretty(contents)
+ JSON.pretty_generate(contents)
else
contents
end
diff --git a/spec/support/shared/shared_examples.rb b/spec/support/shared/shared_examples.rb
deleted file mode 100644
index b20c65f8b6..0000000000
--- a/spec/support/shared/shared_examples.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# For storing any examples shared between multiple tests
-
-# Any object which defines a .to_json should import this test
-shared_examples "to_json equalivent to Chef::JSONCompat.to_json" do
-
- let(:jsonable) {
- raise "You must define the subject when including this test"
- }
-
- it "should allow consumers to call #to_json or Chef::JSONCompat.to_json" do
- expect(jsonable.to_json).to eq(Chef::JSONCompat.to_json(jsonable))
- end
-
-end
diff --git a/spec/tiny_server.rb b/spec/tiny_server.rb
index a2cfe168d5..7e6ef3a809 100644
--- a/spec/tiny_server.rb
+++ b/spec/tiny_server.rb
@@ -22,6 +22,7 @@ require 'webrick/https'
require 'rack'
#require 'thin'
require 'singleton'
+require 'chef/json_compat'
require 'open-uri'
require 'chef/config'
@@ -151,7 +152,7 @@ module TinyServer
:available_routes => @routes, :request => env}
# Uncomment me for glorious debugging
# pp :not_found => debug_info
- [404, {'Content-Type' => 'application/json'}, [ Chef::JSONCompat.to_json(debug_info) ]]
+ [404, {'Content-Type' => 'application/json'}, [ debug_info.to_json ]]
end
end
diff --git a/spec/unit/api_client_spec.rb b/spec/unit/api_client_spec.rb
index bd6c5ef7fd..76fc4afb5c 100644
--- a/spec/unit/api_client_spec.rb
+++ b/spec/unit/api_client_spec.rb
@@ -123,10 +123,6 @@ describe Chef::ApiClient do
it "does not include the private key if not present" do
@json.should_not include("private_key")
end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { @client }
- end
end
describe "when deserializing from JSON" do
@@ -139,7 +135,7 @@ describe Chef::ApiClient do
"validator" => true,
"json_class" => "Chef::ApiClient"
}
- @client = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(client))
+ @client = Chef::JSONCompat.from_json(client.to_json)
end
it "should deserialize to a Chef::ApiClient object" do
diff --git a/spec/unit/config_fetcher_spec.rb b/spec/unit/config_fetcher_spec.rb
index 31787a0909..f6d5436a11 100644
--- a/spec/unit/config_fetcher_spec.rb
+++ b/spec/unit/config_fetcher_spec.rb
@@ -1,8 +1,7 @@
require 'spec_helper'
require 'chef/config_fetcher'
-
describe Chef::ConfigFetcher do
- let(:valid_json) { Chef::JSONCompat.to_json({:a=>"b"}) }
+ let(:valid_json) { {:a=>"b"}.to_json }
let(:invalid_json) { %q[{"syntax-error": "missing quote}] }
let(:http) { double("Chef::HTTP::Simple") }
diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb
index 86be0d2390..e61c85b42b 100644
--- a/spec/unit/cookbook/metadata_spec.rb
+++ b/spec/unit/cookbook/metadata_spec.rb
@@ -623,13 +623,9 @@ describe Chef::Cookbook::Metadata do
metadata.version "1.2.3"
end
- it "should produce the same output from to_json and Chef::JSONCompat" do
- expect(metadata.to_json).to eq(Chef::JSONCompat.to_json(metadata))
- end
-
describe "serialize" do
- let(:deserialized_metadata) { Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(metadata)) }
+ let(:deserialized_metadata) { Chef::JSONCompat.from_json(metadata.to_json) }
it "should serialize to a json hash" do
deserialized_metadata.should be_a_kind_of(Hash)
@@ -661,7 +657,7 @@ describe Chef::Cookbook::Metadata do
describe "deserialize" do
- let(:deserialized_metadata) { Chef::Cookbook::Metadata.from_json(Chef::JSONCompat.to_json(metadata)) }
+ let(:deserialized_metadata) { Chef::Cookbook::Metadata.from_json(metadata.to_json) }
it "should deserialize to a Chef::Cookbook::Metadata object" do
diff --git a/spec/unit/cookbook_loader_spec.rb b/spec/unit/cookbook_loader_spec.rb
index deaf393d7a..f40bbd5696 100644
--- a/spec/unit/cookbook_loader_spec.rb
+++ b/spec/unit/cookbook_loader_spec.rb
@@ -210,7 +210,7 @@ describe Chef::CookbookLoader do
aa.to_hash["metadata"].recipes.keys.should include("openldap")
expected_desc = "Main Open LDAP configuration"
aa.to_hash["metadata"].recipes["openldap"].should == expected_desc
- raw = Chef::JSONCompat.to_json(aa.to_hash["metadata"].recipes)
+ raw = aa.to_hash["metadata"].recipes.to_json
search_str = "\"openldap\":\""
key_idx = raw.index(search_str)
key_idx.should be > 0
diff --git a/spec/unit/cookbook_version_spec.rb b/spec/unit/cookbook_version_spec.rb
index 25bc936569..f20bc3766a 100644
--- a/spec/unit/cookbook_version_spec.rb
+++ b/spec/unit/cookbook_version_spec.rb
@@ -422,8 +422,4 @@ describe Chef::CookbookVersion do
end
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { Chef::CookbookVersion.new("tatft", '/tmp/blah') }
- end
-
end
diff --git a/spec/unit/data_bag_item_spec.rb b/spec/unit/data_bag_item_spec.rb
index 5972d8a239..ead0dadfa2 100644
--- a/spec/unit/data_bag_item_spec.rb
+++ b/spec/unit/data_bag_item_spec.rb
@@ -166,7 +166,7 @@ describe Chef::DataBagItem do
before(:each) do
@data_bag_item.data_bag('mars_volta')
@data_bag_item.raw_data = { "id" => "octahedron", "snooze" => { "finally" => :world_will }}
- @deserial = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(@data_bag_item))
+ @deserial = Chef::JSONCompat.from_json(@data_bag_item.to_json)
end
it "should deserialize to a Chef::DataBagItem object" do
@@ -184,10 +184,6 @@ describe Chef::DataBagItem do
it "should have a matching 'snooze' key" do
@deserial["snooze"].should == { "finally" => "world_will" }
end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { @data_bag_item }
- end
end
describe "when converting to a string" do
diff --git a/spec/unit/data_bag_spec.rb b/spec/unit/data_bag_spec.rb
index ff323902eb..c905277b7c 100644
--- a/spec/unit/data_bag_spec.rb
+++ b/spec/unit/data_bag_spec.rb
@@ -59,7 +59,7 @@ describe Chef::DataBag do
describe "deserialize" do
before(:each) do
@data_bag.name('mars_volta')
- @deserial = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(@data_bag))
+ @deserial = Chef::JSONCompat.from_json(@data_bag.to_json)
end
it "should deserialize to a Chef::DataBag object" do
@@ -72,10 +72,6 @@ describe Chef::DataBag do
it "should match '#{t}'" do
@deserial.send(t.to_sym).should == @data_bag.send(t.to_sym)
end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { @data_bag }
- end
end
end
diff --git a/spec/unit/encrypted_data_bag_item_spec.rb b/spec/unit/encrypted_data_bag_item_spec.rb
index 9335889ef3..5ee245b9bc 100644
--- a/spec/unit/encrypted_data_bag_item_spec.rb
+++ b/spec/unit/encrypted_data_bag_item_spec.rb
@@ -168,17 +168,6 @@ describe Chef::EncryptedDataBagItem::Decryptor do
let(:plaintext_data) { {"foo" => "bar"} }
let(:encryption_key) { "passwd" }
let(:decryption_key) { encryption_key }
- let(:json_wrapped_data) { Chef::JSONCompat.to_json({"json_wrapper" => plaintext_data}) }
-
- shared_examples "decryption examples" do
- it "decrypts the encrypted value" do
- decryptor.decrypted_data.should eq(json_wrapped_data)
- end
-
- it "unwraps the encrypted data and returns it" do
- decryptor.for_decrypted_item.should eq plaintext_data
- end
- end
context "when decrypting a version 3 (JSON+aes-256-gcm+random iv+auth tag) encrypted value" do
@@ -190,7 +179,13 @@ describe Chef::EncryptedDataBagItem::Decryptor do
let(:bogus_auth_tag) { "bogus_auth_tag" }
- include_examples "decryption examples"
+ it "decrypts the encrypted value" do
+ decryptor.decrypted_data.should eq({"json_wrapper" => plaintext_data}.to_json)
+ end
+
+ it "unwraps the encrypted data and returns it" do
+ decryptor.for_decrypted_item.should eq plaintext_data
+ end
it "rejects the data if the authentication tag is wrong" do
encrypted_value["auth_tag"] = bogus_auth_tag
@@ -245,7 +240,13 @@ describe Chef::EncryptedDataBagItem::Decryptor do
Base64.encode64(raw_hmac)
end
- include_examples "decryption examples"
+ it "decrypts the encrypted value" do
+ decryptor.decrypted_data.should eq({"json_wrapper" => plaintext_data}.to_json)
+ end
+
+ it "unwraps the encrypted data and returns it" do
+ decryptor.for_decrypted_item.should eq plaintext_data
+ end
it "rejects the data if the hmac is wrong" do
encrypted_value["hmac"] = bogus_hmac
@@ -269,7 +270,13 @@ describe Chef::EncryptedDataBagItem::Decryptor do
decryptor.should be_a_instance_of Chef::EncryptedDataBagItem::Decryptor::Version1Decryptor
end
- include_examples "decryption examples"
+ it "decrypts the encrypted value" do
+ decryptor.decrypted_data.should eq({"json_wrapper" => plaintext_data}.to_json)
+ end
+
+ it "unwraps the encrypted data and returns it" do
+ decryptor.for_decrypted_item.should eq plaintext_data
+ end
describe "and the decryption step returns invalid data" do
it "raises a decryption failure error" do
diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb
index ffb8fbfeaf..5a2c400d3c 100644
--- a/spec/unit/environment_spec.rb
+++ b/spec/unit/environment_spec.rb
@@ -196,7 +196,7 @@ describe Chef::Environment do
%w{name description cookbook_versions}.each do |t|
it "should include '#{t}'" do
- @json.should =~ /"#{t}":#{Regexp.escape(Chef::JSONCompat.to_json(@environment.send(t.to_sym)))}/
+ @json.should =~ /"#{t}":#{Regexp.escape(@environment.send(t.to_sym).to_json)}/
end
end
@@ -207,10 +207,6 @@ describe Chef::Environment do
it "should include 'chef_type'" do
@json.should =~ /"chef_type":"environment"/
end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { @environment }
- end
end
describe "from_json" do
@@ -226,7 +222,7 @@ describe Chef::Environment do
"json_class" => "Chef::Environment",
"chef_type" => "environment"
}
- @environment = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(@data))
+ @environment = Chef::JSONCompat.from_json(@data.to_json)
end
it "should return a Chef::Environment" do
diff --git a/spec/unit/exceptions_spec.rb b/spec/unit/exceptions_spec.rb
index 21b0abb9bf..3e7b1ba93f 100644
--- a/spec/unit/exceptions_spec.rb
+++ b/spec/unit/exceptions_spec.rb
@@ -74,11 +74,5 @@ describe Chef::Exceptions do
it "should have an exception class of #{exception} which inherits from #{expected_super_class}" do
lambda{ raise exception }.should raise_error(expected_super_class)
end
-
- if exception.methods.include?(:to_json)
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { exception }
- end
- end
end
end
diff --git a/spec/unit/json_compat_spec.rb b/spec/unit/json_compat_spec.rb
index 65d931df70..e355a47faa 100644
--- a/spec/unit/json_compat_spec.rb
+++ b/spec/unit/json_compat_spec.rb
@@ -58,17 +58,13 @@ describe Chef::JSONCompat do
describe "when pretty printing an object that defines #to_json" do
class Foo
def to_json(*a)
- Chef::JSONCompat.to_json({'foo' => 1234, 'bar' => {'baz' => 5678}}, *a)
+ {'foo' => 1234}.to_json(*a)
end
end
it "should work" do
f = Foo.new
- expect(Chef::JSONCompat.to_json_pretty(f)).to eql("{\n \"foo\": 1234,\n \"bar\": {\n \"baz\": 5678\n }\n}\n")
- end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { Foo.new }
+ expect(Chef::JSONCompat.to_json_pretty(f)).to eql("{\n \"foo\": 1234\n}\n")
end
end
@@ -101,10 +97,4 @@ describe Chef::JSONCompat do
end
end
end
-
- it "should define .to_json on all classes" do
- class SomeClass; end
-
- expect(SomeClass.new.respond_to?(:to_json)).to eq(true)
- end
end
diff --git a/spec/unit/knife/cookbook_site_share_spec.rb b/spec/unit/knife/cookbook_site_share_spec.rb
index ad3f32fecc..902e5f6115 100644
--- a/spec/unit/knife/cookbook_site_share_spec.rb
+++ b/spec/unit/knife/cookbook_site_share_spec.rb
@@ -109,7 +109,7 @@ describe Chef::Knife::CookbookSiteShare do
end
it 'should post the cookbook to "https://supermarket.getchef.com"' do
- response_text = Chef::JSONCompat.to_json({:uri => 'https://supermarket.getchef.com/cookbooks/cookbook_name'})
+ response_text = {:uri => 'https://supermarket.getchef.com/cookbooks/cookbook_name'}.to_json
@upload_response.stub(:body).and_return(response_text)
@upload_response.stub(:code).and_return(201)
Chef::CookbookSiteStreamingUploader.should_receive(:post).with(/supermarket\.getchef\.com/, anything(), anything(), anything())
@@ -117,7 +117,7 @@ describe Chef::Knife::CookbookSiteShare do
end
it 'should alert the user when a version already exists' do
- response_text = Chef::JSONCompat.to_json({:error_messages => ['Version already exists']})
+ response_text = {:error_messages => ['Version already exists']}.to_json
@upload_response.stub(:body).and_return(response_text)
@upload_response.stub(:code).and_return(409)
lambda { @knife.run }.should raise_error(SystemExit)
@@ -125,7 +125,7 @@ describe Chef::Knife::CookbookSiteShare do
end
it 'should pass any errors on to the user' do
- response_text = Chef::JSONCompat.to_json({:error_messages => ["You're holding it wrong"]})
+ response_text = {:error_messages => ["You're holding it wrong"]}.to_json
@upload_response.stub(:body).and_return(response_text)
@upload_response.stub(:code).and_return(403)
lambda { @knife.run }.should raise_error(SystemExit)
@@ -133,7 +133,7 @@ describe Chef::Knife::CookbookSiteShare do
end
it 'should print the body if no errors are exposed on failure' do
- response_text = Chef::JSONCompat.to_json({:system_error => "Your call was dropped", :reason => "There's a map for that"})
+ response_text = {:system_error => "Your call was dropped", :reason => "There's a map for that"}.to_json
@upload_response.stub(:body).and_return(response_text)
@upload_response.stub(:code).and_return(500)
@knife.ui.should_receive(:error).with(/#{Regexp.escape(response_text)}/)#.ordered
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index cd53088419..266991a7dd 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -95,13 +95,13 @@ EXPECTED
describe "when JSON attributes are given" do
let(:config) { {:first_boot_attributes => {:baz => :quux}} }
it "adds the attributes to first_boot" do
- Chef::JSONCompat.to_json(bootstrap_context.first_boot).should eq(Chef::JSONCompat.to_json({:baz => :quux, :run_list => run_list}))
+ bootstrap_context.first_boot.to_json.should eq({:baz => :quux, :run_list => run_list}.to_json)
end
end
describe "when JSON attributes are NOT given" do
it "sets first_boot equal to run_list" do
- Chef::JSONCompat.to_json(bootstrap_context.first_boot).should eq(Chef::JSONCompat.to_json({:run_list => run_list}))
+ bootstrap_context.first_boot.to_json.should eq({:run_list => run_list}.to_json)
end
end
diff --git a/spec/unit/knife/data_bag_from_file_spec.rb b/spec/unit/knife/data_bag_from_file_spec.rb
index 8de046e7a4..dba5cc282b 100644
--- a/spec/unit/knife/data_bag_from_file_spec.rb
+++ b/spec/unit/knife/data_bag_from_file_spec.rb
@@ -29,7 +29,7 @@ describe Chef::Knife::DataBagFromFile do
Chef::Platform.stub(:windows?) { false }
Chef::Config[:node_name] = "webmonkey.example.com"
FileUtils.mkdir_p([db_folder, db_folder2])
- db_file.write(Chef::JSONCompat.to_json(plain_data))
+ db_file.write(plain_data.to_json)
db_file.flush
allow(knife).to receive(:config).and_return(config)
allow(Chef::Knife::Core::ObjectLoader).to receive(:new).and_return(loader)
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 00879dcb13..21a978a9c9 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -762,13 +762,6 @@ describe Chef::Node do
end
serialized_node.run_list.should == node.run_list
end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) {
- node.from_file(File.expand_path("nodes/test.example.com.rb", CHEF_SPEC_DATA))
- node
- }
- end
end
describe "to_s" do
diff --git a/spec/unit/provider/remote_file/cache_control_data_spec.rb b/spec/unit/provider/remote_file/cache_control_data_spec.rb
index 8a849d9d7d..8e396b1b40 100644
--- a/spec/unit/provider/remote_file/cache_control_data_spec.rb
+++ b/spec/unit/provider/remote_file/cache_control_data_spec.rb
@@ -85,7 +85,7 @@ describe Chef::Provider::RemoteFile::CacheControlData do
cache["etag"] = etag
cache["mtime"] = mtime
cache["checksum"] = last_fetched_checksum
- Chef::JSONCompat.to_json(cache)
+ cache.to_json
end
before do
diff --git a/spec/unit/resource_collection_spec.rb b/spec/unit/resource_collection_spec.rb
index cf119f1ab0..eddd92e098 100644
--- a/spec/unit/resource_collection_spec.rb
+++ b/spec/unit/resource_collection_spec.rb
@@ -278,20 +278,12 @@ describe Chef::ResourceCollection do
json.should =~ /json_class/
json.should =~ /instance_vars/
end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { @rc }
- end
end
describe "self.from_json" do
- it "should not respond to this method" do
- expect(@rc.respond_to?(:from_json)).to eq(false)
- end
-
- it "should convert from json using the CHEF::JSONCompat library" do
+ it "should deserialize itself from json" do
@rc << @resource
- json = Chef::JSONCompat.to_json(@rc)
+ json = @rc.to_json
s_rc = Chef::JSONCompat.from_json(json)
s_rc.should be_a_kind_of(Chef::ResourceCollection)
s_rc[0].name.should eql(@resource.name)
diff --git a/spec/unit/resource_reporter_spec.rb b/spec/unit/resource_reporter_spec.rb
index 1a89cbdce1..fe6a895b5a 100644
--- a/spec/unit/resource_reporter_spec.rb
+++ b/spec/unit/resource_reporter_spec.rb
@@ -421,7 +421,7 @@ describe Chef::ResourceReporter do
it "includes the run_list" do
@report.should have_key("run_list")
- @report["run_list"].should == Chef::JSONCompat.to_json(@run_status.node.run_list)
+ @report["run_list"].should == @run_status.node.run_list.to_json
end
it "includes the end_time" do
@@ -484,7 +484,7 @@ describe Chef::ResourceReporter do
it "includes the exception trace in the event data" do
@report["data"]["exception"].should have_key("backtrace")
- @report["data"]["exception"]["backtrace"].should == Chef::JSONCompat.to_json(@backtrace)
+ @report["data"]["exception"]["backtrace"].should == @backtrace.to_json
end
it "includes the error inspector output in the event data" do
@@ -701,7 +701,7 @@ describe Chef::ResourceReporter do
})
data_stream = Zlib::GzipReader.new(StringIO.new(data))
data = data_stream.read
- data.should eq(Chef::JSONCompat.to_json(@expected_data))
+ data.should eq(@expected_data.to_json)
response
end
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 692345c943..e85633eaab 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -336,10 +336,6 @@ describe Chef::Resource do
json.should =~ /json_class/
json.should =~ /instance_vars/
end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { @resource }
- end
end
describe "to_hash" do
@@ -358,7 +354,7 @@ describe Chef::Resource do
describe "self.json_create" do
it "should deserialize itself from json" do
- json = Chef::JSONCompat.to_json(@resource)
+ json = @resource.to_json
serialized_node = Chef::JSONCompat.from_json(json)
serialized_node.should be_a_kind_of(Chef::Resource)
serialized_node.name.should eql(@resource.name)
diff --git a/spec/unit/role_spec.rb b/spec/unit/role_spec.rb
index 1a108c4247..f3fa7e1868 100644
--- a/spec/unit/role_spec.rb
+++ b/spec/unit/role_spec.rb
@@ -216,10 +216,6 @@ describe Chef::Role do
end
end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { @role }
- end
end
describe "when created from JSON", :json => true do
diff --git a/spec/unit/run_list_spec.rb b/spec/unit/run_list_spec.rb
index cc7e29af0f..220e4ea4a6 100644
--- a/spec/unit/run_list_spec.rb
+++ b/spec/unit/run_list_spec.rb
@@ -304,11 +304,7 @@ describe Chef::RunList do
end
it "converts to json by converting its array form" do
- Chef::JSONCompat.to_json(@run_list).should == Chef::JSONCompat.to_json(["recipe[nagios::client]", "role[production]", "recipe[apache2]"])
- end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { @run_list }
+ @run_list.to_json.should == ["recipe[nagios::client]", "role[production]", "recipe[apache2]"].to_json
end
end
diff --git a/spec/unit/user_spec.rb b/spec/unit/user_spec.rb
index 2f2299c5bd..08bde33d7b 100644
--- a/spec/unit/user_spec.rb
+++ b/spec/unit/user_spec.rb
@@ -154,10 +154,6 @@ describe Chef::User do
it "does not include the password if not present" do
@json.should_not include("password")
end
-
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
- let(:jsonable) { @user }
- end
end
describe "when deserializing from JSON" do
@@ -167,7 +163,7 @@ describe Chef::User do
"private_key" => "pandas",
"password" => "password",
"admin" => true }
- @user = Chef::User.from_json(Chef::JSONCompat.to_json(user))
+ @user = Chef::User.from_json(user.to_json)
end
it "should deserialize to a Chef::User object" do