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
1 changed files with 7 additions and 0 deletions

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