diff options
author | lulalala <mark@goodlife.tw> | 2018-04-03 00:17:45 +0800 |
---|---|---|
committer | lulalala <mark@goodlife.tw> | 2019-03-31 22:59:12 +0800 |
commit | cccbac6df6de18b98e300fdd973758447446dbee (patch) | |
tree | 4b5565486d67716e68c20af2b12550f83c3e93fc /activemodel/test/cases | |
parent | 86b4aa1175b23deca15981fbc19cf7f02b13b25d (diff) | |
download | rails-cccbac6df6de18b98e300fdd973758447446dbee.tar.gz rails-cccbac6df6de18b98e300fdd973758447446dbee.tar.bz2 rails-cccbac6df6de18b98e300fdd973758447446dbee.zip |
Add a transitional method `objects`, for accessing the array directly.
This is because we try to accommodate old hash behavior, so `first` and `last` now does not return Error object.
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index 58aa7ee147..048b8a92fb 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -159,14 +159,14 @@ class ErrorsTest < ActiveModel::TestCase assert_equal :name, error.attribute assert_equal :blank, error.type - assert_equal error, person.errors.first + assert_equal error, person.errors.objects.first end test "add, with type as symbol" do person = Person.new person.errors.add(:name, :blank) - assert_equal :blank, person.errors.first.type + assert_equal :blank, person.errors.objects.first.type assert_equal ["can't be blank"], person.errors[:name] end @@ -183,7 +183,7 @@ class ErrorsTest < ActiveModel::TestCase person = Person.new person.errors.add(:name) - assert_equal :invalid, person.errors.first.type + assert_equal :invalid, person.errors.objects.first.type assert_equal ["is invalid"], person.errors[:name] end @@ -203,7 +203,7 @@ class ErrorsTest < ActiveModel::TestCase person = Person.new person.errors.add(:name, type) - assert_equal :blank, person.errors.first.type + assert_equal :blank, person.errors.objects.first.type assert_equal ["can't be blank"], person.errors[:name] end @@ -214,7 +214,7 @@ class ErrorsTest < ActiveModel::TestCase person = Person.new person.errors.add(:name, :blank, message: type) - assert_equal :blank, person.errors.first.type + assert_equal :blank, person.errors.objects.first.type assert_equal [msg], person.errors[:name] end @@ -225,7 +225,7 @@ class ErrorsTest < ActiveModel::TestCase person = Person.new person.errors.add(:name, message: type) - assert_equal :invalid, person.errors.first.type + assert_equal :invalid, person.errors.objects.first.type assert_equal [msg], person.errors[:name] end |