1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add test for allow_blank in numericality validation

Signed-off-by: Guillermo Iguaran <guilleiguaran@gmail.com>
This commit is contained in:
Nicolai Reuschling 2016-08-25 08:31:19 +02:00 committed by Guillermo Iguaran
parent f3f8589f77
commit 43f1b23a75

View file

@ -35,6 +35,13 @@ class NumericalityValidationTest < ActiveModel::TestCase
valid!(NIL + FLOATS + INTEGERS + BIGDECIMAL + INFINITY)
end
def test_validates_numericality_of_with_blank_allowed
Topic.validates_numericality_of :approved, allow_blank: true
invalid!(JUNK)
valid!(NIL + BLANK + FLOATS + INTEGERS + BIGDECIMAL + INFINITY)
end
def test_validates_numericality_of_with_integer_only
Topic.validates_numericality_of :approved, only_integer: true