Merge pull request #41858 from jhawthorn/fix_build

Fix build on Ruby 3.0.1
This commit is contained in:
John Hawthorn 2021-04-06 11:32:32 -07:00 committed by GitHub
commit da795a678b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -111,9 +111,10 @@ class NumericalityValidationTest < ActiveRecord::TestCase
subject = model_class.new(virtual_decimal_number: 123.455)
if RUBY_VERSION > "3.0.0"
if 123.455.to_d(5) == BigDecimal("123.46")
# BigDecimal's to_d behavior changed in BigDecimal 3.0.1, see https://github.com/ruby/bigdecimal/issues/70
# TODO: replace this with a check against BigDecimal::VERSION
# TODO: replace this with a check against BigDecimal::VERSION, currently
# we just check the behaviour because both versions of BigDecimal report "3.0.0"
assert_not_predicate subject, :valid?
else
assert_predicate subject, :valid?