From a59d661a82e684e23fd7295443e5d1264315df2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 10 May 2013 13:36:42 -0300 Subject: Fix test to ruby 2.0 The default enconding changed on Ruby 2.0 --- activesupport/test/json/encoding_test.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'activesupport/test/json') diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb index 67b648e6db..72366f9ab4 100644 --- a/activesupport/test/json/encoding_test.rb +++ b/activesupport/test/json/encoding_test.rb @@ -117,11 +117,18 @@ class TestJSONEncoding < Test::Unit::TestCase assert_equal Encoding::UTF_8, result.encoding end - def test_utf8_hash_key + def test_utf8_hash_key_does_not_change_the_encoding w = { '𠜎' => 'a' } result = ActiveSupport::JSON.encode(w) assert_equal '{"\\u070e":"a"}', result - assert_equal Encoding::US_ASCII, result.encoding + + if RUBY_VERSION >= '2.0' + expected_encoding = Encoding::UTF_8 + else + expected_encoding = Encoding::US_ASCII + end + + assert_equal expected_encoding, result.encoding end end -- cgit v1.2.3