diff options
author | lulalala <mark@goodlife.tw> | 2018-12-22 20:25:02 +0800 |
---|---|---|
committer | lulalala <mark@goodlife.tw> | 2019-03-31 22:59:12 +0800 |
commit | 67d262f70f47154b2476b5fcadf21dd63ebc2597 (patch) | |
tree | fce1f16b3c13e4a931d6c7216059a52fb64b3301 /activemodel/test | |
parent | be1585fca07c0823009014c5539e49dc7396524c (diff) | |
download | rails-67d262f70f47154b2476b5fcadf21dd63ebc2597.tar.gz rails-67d262f70f47154b2476b5fcadf21dd63ebc2597.tar.bz2 rails-67d262f70f47154b2476b5fcadf21dd63ebc2597.zip |
Add deprecation to slice!
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index 048b8a92fb..5dbbf910de 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -563,11 +563,9 @@ class ErrorsTest < ActiveModel::TestCase person.errors.add(:gender, "cannot be nil") person.errors.add(:city, "cannot be nil") - person.errors.slice!(:age, "gender") + assert_deprecated { person.errors.slice!(:age, "gender") } - assert_deprecated do - assert_equal [:age, :gender], person.errors.keys - end + assert_equal [:age, :gender], assert_deprecated { person.errors.keys } end test "slice! returns the deleted errors" do @@ -577,7 +575,7 @@ class ErrorsTest < ActiveModel::TestCase person.errors.add(:gender, "cannot be nil") person.errors.add(:city, "cannot be nil") - removed_errors = person.errors.slice!(:age, "gender") + removed_errors = assert_deprecated { person.errors.slice!(:age, "gender") } assert_equal({ name: ["cannot be nil"], city: ["cannot be nil"] }, removed_errors) end |