aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorAbdallah Samman <sammanabdallah@gmail.com>2018-12-03 10:58:10 +0200
committerAbdallah Samman <sammanabdallah@gmail.com>2018-12-03 12:59:38 +0200
commit89b4612ffc97e6648f5cf807906ae210e05acdda (patch)
tree4a00607f856c9d6c38a992b23d0ff7db34ff5b0e /activerecord/test
parente7717ec7a09ca83f92a9819303f7a93e038a2679 (diff)
downloadrails-89b4612ffc97e6648f5cf807906ae210e05acdda.tar.gz
rails-89b4612ffc97e6648f5cf807906ae210e05acdda.tar.bz2
rails-89b4612ffc97e6648f5cf807906ae210e05acdda.zip
Fix NumericData.average test on ruby 2.6
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/calculations_test.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb
index 97bce90c8b..4cb0dc66ed 100644
--- a/activerecord/test/cases/calculations_test.rb
+++ b/activerecord/test/cases/calculations_test.rb
@@ -57,8 +57,12 @@ class CalculationsTest < ActiveRecord::TestCase
assert_equal 3, value
end
- def test_should_return_nil_as_average
- assert_nil NumericData.average(:bank_balance)
+ def test_should_return_nil_to_d_as_average
+ if nil.respond_to?(:to_d)
+ assert_equal BigDecimal(0), NumericData.average(:bank_balance)
+ else
+ assert_nil NumericData.average(:bank_balance)
+ end
end
def test_should_get_maximum_of_field