1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix NumericData.average test on ruby 2.6

This commit is contained in:
Abdallah Samman 2018-12-03 10:58:10 +02:00
parent e7717ec7a0
commit 89b4612ffc

View file

@ -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