Remove active_support/json/variable was deprecated.

This commit is contained in:
kennyj 2013-06-01 13:05:29 +09:00
parent f2855f6ef1
commit 6f3e01e8b7
3 changed files with 0 additions and 26 deletions

View File

@ -2,7 +2,6 @@
require 'active_support/core_ext/object/to_json' require 'active_support/core_ext/object/to_json'
require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/module/delegation'
require 'active_support/json/variable'
require 'bigdecimal' require 'bigdecimal'
require 'active_support/core_ext/big_decimal/conversions' # for #to_s require 'active_support/core_ext/big_decimal/conversions' # for #to_s

View File

@ -1,18 +0,0 @@
require 'active_support/deprecation'
module ActiveSupport
module JSON
# Deprecated: A string that returns itself as its JSON-encoded form.
class Variable < String
def initialize(*args)
message = 'ActiveSupport::JSON::Variable is deprecated and will be removed in Rails 4.1. ' \
'For your own custom JSON literals, define #as_json and #encode_json yourself.'
ActiveSupport::Deprecation.warn message
super
end
def as_json(options = nil) self end #:nodoc:
def encode_json(encoder) self end #:nodoc:
end
end
end

View File

@ -96,13 +96,6 @@ class TestJSONEncoding < ActiveSupport::TestCase
end end
end end
def test_json_variable
assert_deprecated do
assert_equal ActiveSupport::JSON::Variable.new('foo'), 'foo'
assert_equal ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")'
end
end
def test_hash_encoding def test_hash_encoding
assert_equal %({\"a\":\"b\"}), ActiveSupport::JSON.encode(:a => :b) assert_equal %({\"a\":\"b\"}), ActiveSupport::JSON.encode(:a => :b)
assert_equal %({\"a\":1}), ActiveSupport::JSON.encode('a' => 1) assert_equal %({\"a\":1}), ActiveSupport::JSON.encode('a' => 1)