提交 6f3e01e8 编写于 作者: K kennyj

Remove active_support/json/variable was deprecated.

上级 f2855f6e
......@@ -2,7 +2,6 @@
require 'active_support/core_ext/object/to_json'
require 'active_support/core_ext/module/delegation'
require 'active_support/json/variable'
require 'bigdecimal'
require 'active_support/core_ext/big_decimal/conversions' # for #to_s
......
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
......@@ -96,13 +96,6 @@ def sorted_json(json)
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
assert_equal %({\"a\":\"b\"}), ActiveSupport::JSON.encode(:a => :b)
assert_equal %({\"a\":1}), ActiveSupport::JSON.encode('a' => 1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册