diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-03-25 13:24:41 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-03-25 13:24:41 +0100 |
commit | 044baef10136f81a535efdcb6110ef872b04d02a (patch) | |
tree | 718aae5bacdafd72ad12f33c7af2fca581aaaea5 /activemodel/test/cases | |
parent | 9ec8113541ad9cbabdd1f969b69f1d1950c1228e (diff) | |
parent | 9848c4632f0a9be19bf8cb9b8aaa146e28602e30 (diff) | |
download | rails-044baef10136f81a535efdcb6110ef872b04d02a.tar.gz rails-044baef10136f81a535efdcb6110ef872b04d02a.tar.bz2 rails-044baef10136f81a535efdcb6110ef872b04d02a.zip |
Merge pull request #24299 from kitop/activemodel-errors-include-fix
Do not create a hash key when calling ActiveModel::Errors#include?
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index a5ac055033..26ba6ba4fb 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -128,6 +128,13 @@ class ErrorsTest < ActiveModel::TestCase assert !person.errors.include?(:foo) end + test "include? does not add a key to messages hash" do + person = Person.new + person.errors.include?(:foo) + + assert_not person.errors.messages.key?(:foo) + end + test "adding errors using conditionals with Person#validate!" do person = Person.new person.validate! |