summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-09-24 09:18:47 -0700
committertyler-ball <tyleraball@gmail.com>2014-10-07 16:39:56 -0700
commit1c7b4629240c49e02c482da6de1a6a2cc574304e (patch)
tree4ac2fdc415837aca9b15e6c93debda44858cbf9b /spec/spec_helper.rb
parent1343bdfff0d54e20b923211f6697d42c484c1627 (diff)
downloadchef-1c7b4629240c49e02c482da6de1a6a2cc574304e.tar.gz
Trying to eradicate all traces of the JSON gem from Chef
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ed0a8f89f6..9d629da226 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -185,3 +185,13 @@ module WEBrick
end
end
end
+
+# We are no longer using the 'json' gem - deny all access to it!
+orig_require = Kernel.send(:instance_method, :require)
+Kernel.send(:remove_method, :require)
+Kernel.send(:define_method, :require) { |path|
+ raise LoadError, 'JSON gem is no longer allowed - use Chef::JSONCompat.to_json' if path == 'json'
+ orig_require.bind(Kernel).call(path)
+}
+# Enough stuff needs json serialization that I'm just adding it here for equality asserts
+require 'chef/json_compat'