aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations/with_validation_test.rb
diff options
context:
space:
mode:
authorDaniel Colson <danieljamescolson@gmail.com>2018-01-25 18:16:57 -0500
committerDaniel Colson <danieljamescolson@gmail.com>2018-01-25 23:32:59 -0500
commit82c39e1a0b5114e2d89a80883a41090567a83196 (patch)
tree476f620e0224130ca3dca3ed4e9b5a58fb0d5da9 /activemodel/test/cases/validations/with_validation_test.rb
parent94333a4c31bd10c1f358c538a167e6a4589bae2d (diff)
downloadrails-82c39e1a0b5114e2d89a80883a41090567a83196.tar.gz
rails-82c39e1a0b5114e2d89a80883a41090567a83196.tar.bz2
rails-82c39e1a0b5114e2d89a80883a41090567a83196.zip
Use assert_empty and assert_not_empty
Diffstat (limited to 'activemodel/test/cases/validations/with_validation_test.rb')
-rw-r--r--activemodel/test/cases/validations/with_validation_test.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activemodel/test/cases/validations/with_validation_test.rb b/activemodel/test/cases/validations/with_validation_test.rb
index b0ebb267f0..8239792c79 100644
--- a/activemodel/test/cases/validations/with_validation_test.rb
+++ b/activemodel/test/cases/validations/with_validation_test.rb
@@ -114,7 +114,7 @@ class ValidatesWithTest < ActiveModel::TestCase
Topic.validates_with(ValidatorPerEachAttribute, attributes: [:title, :content], allow_nil: true)
topic = Topic.new content: ""
assert_predicate topic, :invalid?
- assert_predicate topic.errors[:title], :empty?
+ assert_empty topic.errors[:title]
assert_equal ["Value is "], topic.errors[:content]
end
@@ -122,8 +122,8 @@ class ValidatesWithTest < ActiveModel::TestCase
Topic.validates_with(ValidatorPerEachAttribute, attributes: [:title, :content], allow_blank: true)
topic = Topic.new content: ""
assert_predicate topic, :valid?
- assert_predicate topic.errors[:title], :empty?
- assert_predicate topic.errors[:content], :empty?
+ assert_empty topic.errors[:title]
+ assert_empty topic.errors[:content]
end
test "validates_with can validate with an instance method" do
@@ -131,7 +131,7 @@ class ValidatesWithTest < ActiveModel::TestCase
topic = Topic.new title: "foo"
assert_predicate topic, :valid?
- assert_predicate topic.errors[:title], :empty?
+ assert_empty topic.errors[:title]
topic = Topic.new
assert_not_predicate topic, :valid?
@@ -143,7 +143,7 @@ class ValidatesWithTest < ActiveModel::TestCase
topic = Topic.new title: "foo"
assert_not_predicate topic, :valid?
- assert_predicate topic.errors[:title], :empty?
+ assert_empty topic.errors[:title]
assert_equal ["is missing"], topic.errors[:content]
end
end