aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-09-08 13:12:05 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-09-08 13:12:05 -0300
commitff83868b10001af74c6f258e878bb29be6425c8d (patch)
treea49cbce351c97c695532d11dd3d105e0d89d69ef /activerecord/test
parent8d1af2b10c02ab5ecd32be0d2a5b1f937ddd25e1 (diff)
parente3d99e239dd1b59d31ac90f74186ded8b55de599 (diff)
downloadrails-ff83868b10001af74c6f258e878bb29be6425c8d.tar.gz
rails-ff83868b10001af74c6f258e878bb29be6425c8d.tar.bz2
rails-ff83868b10001af74c6f258e878bb29be6425c8d.zip
Merge pull request #21535 from dmitry/feature/validate-multiple-contexts
Validate multiple contexts on `valid?` and `invalid?` at once
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/validations_test.rb7
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