Permalink
Browse files

Merge pull request #27117 from kirs/activemodel-testing-implementation

Do not rely on Ruby implementation in AM test
  • Loading branch information...
guilleiguaran committed Nov 20, 2016
2 parents 03fc9a4 + 5abf662 commit 9008a60dc5c24b0fe884087095900797ace6263a
Showing with 3 additions and 3 deletions.
  1. +3 −3 activemodel/test/cases/validations/numericality_validation_test.rb
@@ -82,7 +82,7 @@ def test_validates_numericality_with_greater_than_using_differing_numeric_types
Topic.validates_numericality_of :approved, greater_than: BigDecimal.new("97.18")
invalid!([-97.18, BigDecimal.new("97.18"), BigDecimal("-97.18")], "must be greater than 97.18")
valid!([97.18, 98, BigDecimal.new("98")]) # Notice the 97.18 as a float is greater than 97.18 as a BigDecimal due to floating point precision
valid!([97.19, 98, BigDecimal.new("98"), BigDecimal.new("97.19")])
end
def test_validates_numericality_with_greater_than_using_string_value
@@ -123,7 +123,7 @@ def test_validates_numericality_with_equal_to
def test_validates_numericality_with_equal_to_using_differing_numeric_types
Topic.validates_numericality_of :approved, equal_to: BigDecimal.new("97.18")
invalid!([-97.18, 97.18], "must be equal to 97.18")
invalid!([-97.18], "must be equal to 97.18")
valid!([BigDecimal.new("97.18")])
end
@@ -165,7 +165,7 @@ def test_validates_numericality_with_less_than_or_equal_to
def test_validates_numericality_with_less_than_or_equal_to_using_differing_numeric_types
Topic.validates_numericality_of :approved, less_than_or_equal_to: BigDecimal.new("97.18")
invalid!([97.18, 98], "must be less than or equal to 97.18")
invalid!([97.19, 98], "must be less than or equal to 97.18")
valid!([-97.18, BigDecimal.new("-97.18"), BigDecimal.new("97.18")])
end

0 comments on commit 9008a60

Please sign in to comment.