diff options
Diffstat (limited to 'activemodel/test/cases/validations')
-rw-r--r-- | activemodel/test/cases/validations/format_validation_test.rb | 8 | ||||
-rw-r--r-- | activemodel/test/cases/validations/with_validation_test.rb | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/activemodel/test/cases/validations/format_validation_test.rb b/activemodel/test/cases/validations/format_validation_test.rb index e9430cc7c4..2a7088b3e8 100644 --- a/activemodel/test/cases/validations/format_validation_test.rb +++ b/activemodel/test/cases/validations/format_validation_test.rb @@ -16,12 +16,12 @@ class FormatValidationTest < ActiveModel::TestCase t = Topic.new("title" => "i'm incorrect", "content" => "Validation macros rule!") assert t.invalid?, "Shouldn't be valid" assert_equal ["is bad data"], t.errors[:title] - assert_predicate t.errors[:content], :empty? + assert_empty t.errors[:content] t.title = "Validation macros rule!" assert_predicate t, :valid? - assert_predicate t.errors[:title], :empty? + assert_empty t.errors[:title] assert_raise(ArgumentError) { Topic.validates_format_of(:title, :content) } end @@ -42,7 +42,7 @@ class FormatValidationTest < ActiveModel::TestCase assert t.invalid?, "Shouldn't be valid" assert_equal ["is bad data"], t.errors[:title] - assert_predicate t.errors[:content], :empty? + assert_empty t.errors[:content] t.title = "-11" assert t.invalid?, "Shouldn't be valid" @@ -59,7 +59,7 @@ class FormatValidationTest < ActiveModel::TestCase t.title = "1" assert_predicate t, :valid? - assert_predicate t.errors[:title], :empty? + assert_empty t.errors[:title] end def test_validate_format_with_formatted_message 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 |