aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2013-11-19 19:17:55 -0800
committerGodfrey Chan <godfreykfc@gmail.com>2013-11-26 09:51:51 -0800
commit4d02296cfbd69b4d2757dfd20f23d778bb23b81b (patch)
tree8199425bb07b4e92ba4cfa986f2059989ce0b552 /activesupport/test
parentca12db0efbf07c1a3182556e99af4ebbfcd59dee (diff)
downloadrails-4d02296cfbd69b4d2757dfd20f23d778bb23b81b.tar.gz
rails-4d02296cfbd69b4d2757dfd20f23d778bb23b81b.tar.bz2
rails-4d02296cfbd69b4d2757dfd20f23d778bb23b81b.zip
Removed support for encoding BigDecimal as a JSON number
This is because the new encoder will no longer support encode_json. Therefore our only choice is to return `to_i` or `to_s` in `BigDecimal#as_json`. Since casting a BigDecimal to an integer is most likely a lossy operation, we chose to encode it as a string. Support for encoding BigDecimal as a string will return via the `activesupport-json_encoder` gem.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/json/encoding_test.rb11
1 files changed, 0 insertions, 11 deletions
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index 1e32830ced..335023e2c3 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -399,17 +399,6 @@ class TestJSONEncoding < ActiveSupport::TestCase
ActiveSupport::JSON.decode(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
-
def test_nil_true_and_false_represented_as_themselves
assert_equal nil, nil.as_json
assert_equal true, true.as_json