From 87e8719da3e1623ce8d2c9f4e9ebfcbc7ab3a468 Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Tue, 21 Jun 2016 11:18:02 -0400 Subject: [PATCH] Add test to better demonstrate `ActiveModel::Errors#added?` behavior Fixes #25410. --- activemodel/test/cases/errors_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index c90ee7021c..13fa5c76bc 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -219,6 +219,12 @@ class ErrorsTest < ActiveModel::TestCase assert !person.errors.added?(:name, "cannot be blank") end + test "added? returns false when checking for an error, but not providing message arguments" do + person = Person.new + person.errors.add(:name, "cannot be blank") + assert !person.errors.added?(:name) + end + test "size calculates the number of error messages" do person = Person.new person.errors.add(:name, "cannot be blank")