diff options
author | David FRANCOIS <david.francois@webflows.fr> | 2012-04-28 23:44:51 +0200 |
---|---|---|
committer | David FRANCOIS <david.francois@webflows.fr> | 2012-05-02 07:16:00 +0200 |
commit | 18aa1ae29c3459a6b2c10c7634770209a72c6cfe (patch) | |
tree | 8229d8c1ef8c9d0ac0fc6ecf8fe32ce25fd9e41a /activesupport/test/json | |
parent | c0a7038412c60cf48274267f75bc4376e733dc69 (diff) | |
download | rails-18aa1ae29c3459a6b2c10c7634770209a72c6cfe.tar.gz rails-18aa1ae29c3459a6b2c10c7634770209a72c6cfe.tar.bz2 rails-18aa1ae29c3459a6b2c10c7634770209a72c6cfe.zip |
BigDecimal string wrapping in JSON serialization can now be opted-out, fixes #6033
Diffstat (limited to 'activesupport/test/json')
-rw-r--r-- | activesupport/test/json/encoding_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb index babacf4d3a..0566ebf291 100644 --- a/activesupport/test/json/encoding_test.rb +++ b/activesupport/test/json/encoding_test.rb @@ -274,6 +274,17 @@ class TestJSONEncoding < ActiveSupport::TestCase JSON.parse(json_string_and_date)) end + def test_opt_out_big_decimal_string_serialization + big_decimal = BigDecimal('2.5') + + begin + ActiveSupport.encode_big_decimal_as_string = false + assert_equal big_decimal.to_s, big_decimal.to_json + ensure + ActiveSupport.encode_big_decimal_as_string = true + end + end + protected def object_keys(json_object) |