Merge pull request #15748 from akshay-vishnoi/activemodel
Correct typo, add test for validates_absence_of
This commit is contained in:
commit
6a25ddd265
@ -11,7 +11,7 @@ class AbsenceValidationTest < ActiveModel::TestCase
|
||||
CustomReader.clear_validators!
|
||||
end
|
||||
|
||||
def test_validate_absences
|
||||
def test_validates_absence_of
|
||||
Topic.validates_absence_of(:title, :content)
|
||||
t = Topic.new
|
||||
t.title = "foo"
|
||||
@ -23,11 +23,12 @@ def test_validate_absences
|
||||
t.content = "something"
|
||||
assert t.invalid?
|
||||
assert_equal ["must be blank"], t.errors[:content]
|
||||
assert_equal [], t.errors[:title]
|
||||
t.content = ""
|
||||
assert t.valid?
|
||||
end
|
||||
|
||||
def test_accepts_array_arguments
|
||||
def test_validates_absence_of_with_array_arguments
|
||||
Topic.validates_absence_of %w(title content)
|
||||
t = Topic.new
|
||||
t.title = "foo"
|
||||
@ -37,7 +38,7 @@ def test_accepts_array_arguments
|
||||
assert_equal ["must be blank"], t.errors[:content]
|
||||
end
|
||||
|
||||
def test_validates_acceptance_of_with_custom_error_using_quotes
|
||||
def test_validates_absence_of_with_custom_error_using_quotes
|
||||
Person.validates_absence_of :karma, message: "This string contains 'single' and \"double\" quotes"
|
||||
p = Person.new
|
||||
p.karma = "good"
|
||||
|
Loading…
Reference in New Issue
Block a user