Skip to content

Commit f9e4fb9

Browse files
authored
Merge pull request rails#49152 from yahonda/bigdecimal_314_or_higher_will_be_installed
Just check the BigDecimal 3.1+ behavior at `NumericalityValidationTest`
2 parents 5cca7f9 + 1538959 commit f9e4fb9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

activerecord/test/cases/validations/numericality_validation_test.rb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,9 @@ def test_virtual_attribute_with_precision_round_half_even
112112

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

115-
if 123.455.to_d(5) == BigDecimal("123.46")
116-
# BigDecimal's to_d behavior changed in BigDecimal 3.0.1, see https://github.com/ruby/bigdecimal/issues/70
117-
# TODO: replace this with a check against BigDecimal::VERSION, currently
118-
# we just check the behavior because both versions of BigDecimal report "3.0.0"
119-
assert_not_predicate subject, :valid?
120-
else
121-
assert_predicate subject, :valid?
122-
end
115+
# BigDecimal's to_d behavior changed in BigDecimal 3.1.0, see https://github.com/ruby/bigdecimal/issues/70
116+
# Since BigDecimal 3.1.4 or higher is installed as an Active Support dependency, we just check the behavior of BigDecimal 3.1.0+.
117+
assert_not_predicate subject, :valid?
123118
end
124119

125120
def test_virtual_attribute_with_precision_round_up

0 commit comments

Comments
 (0)