diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-09-07 16:46:18 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-09-07 16:46:18 -0300 |
commit | 51dd2588433457960cca592d5b5dac6e0537feac (patch) | |
tree | b28ab98e1d42e2f3f784f39a1ec82330143d7685 /activerecord/test | |
parent | ecb4e4b21b3222b823fa24d4a0598b1f2f63ecfb (diff) | |
parent | 86e3b047ba0349bd88952d4e54504327c3f7e59c (diff) | |
download | rails-51dd2588433457960cca592d5b5dac6e0537feac.tar.gz rails-51dd2588433457960cca592d5b5dac6e0537feac.tar.bz2 rails-51dd2588433457960cca592d5b5dac6e0537feac.zip |
Merge pull request #21069 from dmitry/feature/validate-multiple-contexts-at-once
Validate multiple contexts on `valid?` and `invalid?` at once
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/validations_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb index f4f316f393..a429d06aad 100644 --- a/activerecord/test/cases/validations_test.rb +++ b/activerecord/test/cases/validations_test.rb @@ -52,6 +52,13 @@ class ValidationsTest < ActiveRecord::TestCase assert r.valid?(:special_case) end + def test_invalid_using_multiple_contexts + r = WrongReply.new(:title => 'Wrong Create') + assert r.invalid?([:special_case, :create]) + assert_equal "Invalid", r.errors[:author_name].join + assert_equal "is Wrong Create", r.errors[:title].join + end + def test_validate r = WrongReply.new |