aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorErik Michaels-Ober <sferik@gmail.com>2013-05-11 13:59:37 -0700
committerErik Michaels-Ober <sferik@gmail.com>2013-05-11 21:43:48 -0700
commitce4456fde6f45f1abd020cbdeb520d401299e01f (patch)
treea0d5b9d0173eff0adbd6854e7c6e0ad0c3f6c824 /activesupport/test
parent98ade30e421e2c9e405060bba87ecbd092f11698 (diff)
downloadrails-ce4456fde6f45f1abd020cbdeb520d401299e01f.tar.gz
rails-ce4456fde6f45f1abd020cbdeb520d401299e01f.tar.bz2
rails-ce4456fde6f45f1abd020cbdeb520d401299e01f.zip
Replace multi_json with json
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/json/decoding_test.rb36
1 files changed, 13 insertions, 23 deletions
diff --git a/activesupport/test/json/decoding_test.rb b/activesupport/test/json/decoding_test.rb
index a2d1d0dc39..34ed866848 100644
--- a/activesupport/test/json/decoding_test.rb
+++ b/activesupport/test/json/decoding_test.rb
@@ -55,35 +55,25 @@ class TestJSONDecoding < ActiveSupport::TestCase
%q({"a":"Line1\u000aLine2"}) => {"a"=>"Line1\nLine2"}
}
- backends = [:ok_json]
- backends << :json_gem if defined?(::JSON)
- backends << :yajl if defined?(::Yajl)
-
- backends.each do |backend|
- TESTS.each do |json, expected|
- test "json decodes #{json} with the #{backend} backend" do
- prev = ActiveSupport.parse_json_times
- ActiveSupport.parse_json_times = true
- silence_warnings do
- ActiveSupport::JSON.with_backend backend do
- assert_equal expected, ActiveSupport::JSON.decode(json)
- end
- end
- ActiveSupport.parse_json_times = prev
- end
- end
-
- test "json decodes time json with time parsing disabled with the #{backend} backend" do
+ TESTS.each do |json, expected|
+ test "json decodes #{json}" do
prev = ActiveSupport.parse_json_times
- ActiveSupport.parse_json_times = false
- expected = {"a" => "2007-01-01 01:12:34 Z"}
- ActiveSupport::JSON.with_backend backend do
- assert_equal expected, ActiveSupport::JSON.decode(%({"a": "2007-01-01 01:12:34 Z"}))
+ ActiveSupport.parse_json_times = true
+ silence_warnings do
+ assert_equal expected, ActiveSupport::JSON.decode(json)
end
ActiveSupport.parse_json_times = prev
end
end
+ test "json decodes time json with time parsing disabled" do
+ prev = ActiveSupport.parse_json_times
+ ActiveSupport.parse_json_times = false
+ expected = {"a" => "2007-01-01 01:12:34 Z"}
+ assert_equal expected, ActiveSupport::JSON.decode(%({"a": "2007-01-01 01:12:34 Z"}))
+ ActiveSupport.parse_json_times = prev
+ end
+
def test_failed_json_decoding
assert_raise(ActiveSupport::JSON.parse_error) { ActiveSupport::JSON.decode(%({: 1})) }
end