diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-04-30 21:06:22 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-04-30 21:06:22 -0700 |
commit | 3cc6995e714bc763b40eb3e1d710c1e5ded44384 (patch) | |
tree | 8f2e35192ccede9621fa6d2c6d97058c1eb8404c /activesupport/test | |
parent | cb5b0cf93ff45c3f08ac6b6ce524846419275067 (diff) | |
parent | 7b53d1372df4bbc7a539b5e493ff1491ec460397 (diff) | |
download | rails-3cc6995e714bc763b40eb3e1d710c1e5ded44384.tar.gz rails-3cc6995e714bc763b40eb3e1d710c1e5ded44384.tar.bz2 rails-3cc6995e714bc763b40eb3e1d710c1e5ded44384.zip |
Merge pull request #2532 from hasclass/as_json__encode_infinite_and_nan_floats_as_null
JSON: Encode infinite or NaN floats as `null` to generate valid JSON.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/json/encoding_test.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb index a2e61d88d5..8493f4dc2c 100644 --- a/activesupport/test/json/encoding_test.rb +++ b/activesupport/test/json/encoding_test.rb @@ -27,6 +27,9 @@ class TestJSONEncoding < ActiveSupport::TestCase NilTests = [[ nil, %(null) ]] NumericTests = [[ 1, %(1) ], [ 2.5, %(2.5) ], + [ 0.0/0.0, %(null) ], + [ 1.0/0.0, %(null) ], + [ -1.0/0.0, %(null) ], [ BigDecimal('2.5'), %("#{BigDecimal('2.5').to_s}") ]] StringTests = [[ 'this is the <string>', %("this is the \\u003Cstring\\u003E")], |