Skip to content

Commit da795a6

Browse files
authored
Merge pull request rails#41858 from jhawthorn/fix_build
Fix build on Ruby 3.0.1
2 parents 2762407 + 2399603 commit da795a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

activerecord/test/cases/validations/numericality_validation_test.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ def test_virtual_attribute_with_precision_round_half_even
111111

112112
subject = model_class.new(virtual_decimal_number: 123.455)
113113

114-
if RUBY_VERSION > "3.0.0"
114+
if 123.455.to_d(5) == BigDecimal("123.46")
115115
# BigDecimal's to_d behavior changed in BigDecimal 3.0.1, see https://github.com/ruby/bigdecimal/issues/70
116-
# TODO: replace this with a check against BigDecimal::VERSION
116+
# TODO: replace this with a check against BigDecimal::VERSION, currently
117+
# we just check the behaviour because both versions of BigDecimal report "3.0.0"
117118
assert_not_predicate subject, :valid?
118119
else
119120
assert_predicate subject, :valid?

0 commit comments

Comments
 (0)