aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/json
diff options
context:
space:
mode:
authorErich Menge <erich.menge@me.com>2012-05-30 11:29:09 -0500
committerErich Menge <erich.menge@me.com>2012-05-30 14:32:24 -0500
commitbcfa013399fd2c5b5d25c38912cba3560de1cc57 (patch)
tree351d5a366f9d57a61de17a7461cd26adfa0c88ec /activesupport/test/json
parent624f801d27e946cae2244924e7f6a04565666036 (diff)
downloadrails-bcfa013399fd2c5b5d25c38912cba3560de1cc57.tar.gz
rails-bcfa013399fd2c5b5d25c38912cba3560de1cc57.tar.bz2
rails-bcfa013399fd2c5b5d25c38912cba3560de1cc57.zip
Deprecate ActiveSupport::JSON::Variable
Diffstat (limited to 'activesupport/test/json')
-rw-r--r--activesupport/test/json/encoding_test.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index a9590f164f..d327f34140 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -3,7 +3,7 @@ require 'abstract_unit'
require 'active_support/core_ext/string/inflections'
require 'active_support/json'
-class TestJSONEncoding < Test::Unit::TestCase
+class TestJSONEncoding < ActiveSupport::TestCase
class Foo
def initialize(a, b)
@a, @b = a, b
@@ -46,8 +46,6 @@ class TestJSONEncoding < Test::Unit::TestCase
HashlikeTests = [[ Hashlike.new, %({\"a\":1}) ]]
CustomTests = [[ Custom.new, '"custom"' ]]
- VariableTests = [[ ActiveSupport::JSON::Variable.new('foo'), 'foo'],
- [ ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")']]
RegexpTests = [[ /^a/, '"(?-mix:^a)"' ], [/^\w{1,2}[a-z]+/ix, '"(?ix-m:^\\\\w{1,2}[a-z]+)"']]
DateTests = [[ Date.new(2005,2,1), %("2005/02/01") ]]
@@ -79,6 +77,13 @@ class TestJSONEncoding < Test::Unit::TestCase
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)