aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations/conditional_validation_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/test/cases/validations/conditional_validation_test.rb')
-rw-r--r--activemodel/test/cases/validations/conditional_validation_test.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activemodel/test/cases/validations/conditional_validation_test.rb b/activemodel/test/cases/validations/conditional_validation_test.rb
index 72b4800dce..4c716d5d48 100644
--- a/activemodel/test/cases/validations/conditional_validation_test.rb
+++ b/activemodel/test/cases/validations/conditional_validation_test.rb
@@ -124,15 +124,15 @@ class ConditionalValidationTest < ActiveModel::TestCase
Topic.validates_presence_of(:author_name, :if => "title.to_s.match('important')")
t = Topic.new
- assert !t.valid?, "A topic without a title should not be valid"
- assert !t.errors.invalid?("author_name"), "A topic without an 'important' title should not require an author"
+ assert t.invalid?, "A topic without a title should not be valid"
+ assert t.errors[:author_name].empty?, "A topic without an 'important' title should not require an author"
t.title = "Just a title"
assert t.valid?, "A topic with a basic title should be valid"
t.title = "A very important title"
assert !t.valid?, "A topic with an important title, but without an author, should not be valid"
- assert t.errors.invalid?("author_name"), "A topic with an 'important' title should require an author"
+ assert t.errors[:author_name].any?, "A topic with an 'important' title should require an author"
t.author_name = "Hubert J. Farnsworth"
assert t.valid?, "A topic with an important title and author should be valid"