aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations/validations_context_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-09-07 17:16:54 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-09-07 17:16:54 -0300
commit7b9b0b531f9cb6a64737efc5c46890b4609847bf (patch)
tree22a37eeb9b3418a86b62051b9ece467a45b02443 /activemodel/test/cases/validations/validations_context_test.rb
parent51dd2588433457960cca592d5b5dac6e0537feac (diff)
downloadrails-7b9b0b531f9cb6a64737efc5c46890b4609847bf.tar.gz
rails-7b9b0b531f9cb6a64737efc5c46890b4609847bf.tar.bz2
rails-7b9b0b531f9cb6a64737efc5c46890b4609847bf.zip
Revert "Merge pull request #21069 from dmitry/feature/validate-multiple-contexts-at-once"
This reverts commit 51dd2588433457960cca592d5b5dac6e0537feac, reversing changes made to ecb4e4b21b3222b823fa24d4a0598b1f2f63ecfb. This broke Active Record tests
Diffstat (limited to 'activemodel/test/cases/validations/validations_context_test.rb')
-rw-r--r--activemodel/test/cases/validations/validations_context_test.rb19
1 files changed, 0 insertions, 19 deletions
diff --git a/activemodel/test/cases/validations/validations_context_test.rb b/activemodel/test/cases/validations/validations_context_test.rb
index b901a1523e..150dce379f 100644
--- a/activemodel/test/cases/validations/validations_context_test.rb
+++ b/activemodel/test/cases/validations/validations_context_test.rb
@@ -8,7 +8,6 @@ class ValidationsContextTest < ActiveModel::TestCase
end
ERROR_MESSAGE = "Validation error from validator"
- ANOTHER_ERROR_MESSAGE = "Another validation error from validator"
class ValidatorThatAddsErrors < ActiveModel::Validator
def validate(record)
@@ -16,12 +15,6 @@ class ValidationsContextTest < ActiveModel::TestCase
end
end
- class AnotherValidatorThatAddsErrors < ActiveModel::Validator
- def validate(record)
- record.errors[:base] << ANOTHER_ERROR_MESSAGE
- end
- end
-
test "with a class that adds errors on create and validating a new model with no arguments" do
Topic.validates_with(ValidatorThatAddsErrors, on: :create)
topic = Topic.new
@@ -53,16 +46,4 @@ class ValidationsContextTest < ActiveModel::TestCase
assert topic.invalid?(:context2), "Validation did not run on context2 when 'on' is set to context1 and context2"
assert topic.errors[:base].include?(ERROR_MESSAGE)
end
-
- test "with a class that validating a model for a multiple contexts" do
- Topic.validates_with(ValidatorThatAddsErrors, on: :context1)
- Topic.validates_with(AnotherValidatorThatAddsErrors, on: :context2)
-
- topic = Topic.new
- assert topic.valid?, "Validation ran with no context given when 'on' is set to context1 and context2"
-
- assert topic.invalid?([:context1, :context2]), "Validation did not run on context1 when 'on' is set to context1 and context2"
- assert topic.errors[:base].include?(ERROR_MESSAGE)
- assert topic.errors[:base].include?(ANOTHER_ERROR_MESSAGE)
- end
end