提交 6a25ddd2 编写于 作者: R Rafael Mendonça França

Merge pull request #15748 from akshay-vishnoi/activemodel

Correct typo, add test for validates_absence_of
......@@ -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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册