diff options
author | Zamith <zamith.28@gmail.com> | 2015-05-04 13:36:26 +0100 |
---|---|---|
committer | Zamith <zamith.28@gmail.com> | 2015-05-04 13:36:26 +0100 |
commit | 6f418a09d82351ae74409379f80012f717aa9cb0 (patch) | |
tree | 58f68e5f6129e30c2e305e3f4797fdbe59ae22aa /activemodel/test/cases | |
parent | 21c74bd769f6c873453e9244b0de7ced40a532be (diff) | |
download | rails-6f418a09d82351ae74409379f80012f717aa9cb0.tar.gz rails-6f418a09d82351ae74409379f80012f717aa9cb0.tar.bz2 rails-6f418a09d82351ae74409379f80012f717aa9cb0.zip |
Adds/Corrects use case for adding an error message
I believe this is a use case that was supposed to be supported, and it's
a small fix.
Diffstat (limited to 'activemodel/test/cases')
-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 f781a0017f..d10c20caad 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -149,6 +149,12 @@ class ErrorsTest < ActiveModel::TestCase assert_equal ["cannot be blank"], person.errors[:name] end + test "add an error message on a specific attribute with a defined type" do + person = Person.new + person.errors.add(:name, :blank, message: "cannot be blank") + assert_equal ["cannot be blank"], person.errors[:name] + end + test "add an error with a symbol" do person = Person.new person.errors.add(:name, :blank) |