From 3fd7cf903893edae0799c26c2e1e3d4711acc268 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Tue, 25 Jun 2019 11:13:27 +0300 Subject: [PATCH] Revert "PERF: Use Oj for serializing JSON. (#7780)" This commit broke discourse-prometheus. This reverts commit b4df8c546654a4e6f0ec6793bb9ed3230506be69. --- config/initializers/100-oj.rb | 2 -- spec/integrity/oj_spec.rb | 19 ------------------- 2 files changed, 21 deletions(-) delete mode 100644 spec/integrity/oj_spec.rb diff --git a/config/initializers/100-oj.rb b/config/initializers/100-oj.rb index 4cb696c12c1..4e51c78a904 100644 --- a/config/initializers/100-oj.rb +++ b/config/initializers/100-oj.rb @@ -1,6 +1,4 @@ # frozen_string_literal: true -Oj.optimize_rails - # Not sure why it's not using this by default! MultiJson.engine = :oj diff --git a/spec/integrity/oj_spec.rb b/spec/integrity/oj_spec.rb deleted file mode 100644 index 9a02b27d528..00000000000 --- a/spec/integrity/oj_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -describe 'Oj' do - it "is enabled" do - classes = Set.new - tracer = TracePoint.new(:c_call) { |tp| classes << tp.defined_class } - tracer.enable { ActiveModel::ArraySerializer.new([1, 2, 3]).to_json } - - expect(classes).to include(Oj::Rails::Encoder) - end - - it "escapes HTML entities the same as ActiveSupport" do - expect("hello".to_json).to eq("\"\\u003cb\\u003ehello\\u003c/b\\u003e\"") - expect('"hello world"'.to_json). to eq('"\"hello world\""') - expect("\u2028\u2029><&".to_json).to eq('"\u2028\u2029\u003e\u003c\u0026"') - end -end