From 23996030ba0ac4ff096f14757e752262692c18a0 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Tue, 6 Apr 2021 11:13:21 -0700 Subject: [PATCH] Fix build --- .../test/cases/validations/numericality_validation_test.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/activerecord/test/cases/validations/numericality_validation_test.rb b/activerecord/test/cases/validations/numericality_validation_test.rb index 19130b86a4..6df2a0e1e4 100644 --- a/activerecord/test/cases/validations/numericality_validation_test.rb +++ b/activerecord/test/cases/validations/numericality_validation_test.rb @@ -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?