From 7b53d1372df4bbc7a539b5e493ff1491ec460397 Mon Sep 17 00:00:00 2001
From: Sebi Burkhard <sebi.burkhard@gmail.com>
Date: Mon, 15 Aug 2011 16:54:13 +0700
Subject: JSON: Encode infinite or NaN floats as null to generate valid JSON.

---
 activesupport/test/json/encoding_test.rb | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'activesupport/test')

diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index 8cf1a54a99..018207853f 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -27,6 +27,9 @@ class TestJSONEncoding < Test::Unit::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")],
-- 
cgit v1.2.3