diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-07-15 20:41:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-15 20:41:16 +0100 |
commit | 43c27e479a3a8a59064fd7bdb98909ff81a8b3bf (patch) | |
tree | 67f909af97e8a13d8a75635d10ca5e000627633d /activemodel/test | |
parent | bec7be880064c7b50ab9500c3b4fdb4296a8cd4a (diff) | |
parent | 4a8cf101485469194f56ff666b262bd8bb2a538e (diff) | |
download | rails-43c27e479a3a8a59064fd7bdb98909ff81a8b3bf.tar.gz rails-43c27e479a3a8a59064fd7bdb98909ff81a8b3bf.tar.bz2 rails-43c27e479a3a8a59064fd7bdb98909ff81a8b3bf.zip |
Merge pull request #36654 from Edouard-chin/ec-errors-delete
Returns `nil` when `AM::Errors#delete` doesn't delete anything:
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index e7ec9225b0..9d31ed0a99 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -595,6 +595,12 @@ class ErrorsTest < ActiveModel::TestCase assert_not_equal errors_dup.details, errors.details end + test "delete returns nil when no errors were deleted" do + errors = ActiveModel::Errors.new(Person.new) + + assert_nil(errors.delete(:name)) + end + test "delete removes details on given attribute" do errors = ActiveModel::Errors.new(Person.new) errors.add(:name, :invalid) |