Skip to content

Commit 5e5af5b

Browse files
Merge pull request rails#13855 from kuldeepaggarwal/reset_validators
use the new clear_validators! api everywhere to reset validators in tests
2 parents d57ce23 + 20317f3 commit 5e5af5b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

activemodel/test/cases/validations/acceptance_validation_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ def test_validates_acceptance_of_for_ruby_class
6363
p.karma = "1"
6464
assert p.valid?
6565
ensure
66-
Person.reset_callbacks(:validate)
66+
Person.clear_validators!
6767
end
6868
end

activerecord/test/cases/persistence_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ def test_update!
740740

741741
assert_raise(ActiveRecord::RecordInvalid) { reply.update!(title: nil, content: "Have a nice evening") }
742742
ensure
743-
Reply.reset_callbacks(:validate)
743+
Reply.clear_validators!
744744
end
745745

746746
def test_update_attributes!
@@ -761,7 +761,7 @@ def test_update_attributes!
761761

762762
assert_raise(ActiveRecord::RecordInvalid) { reply.update_attributes!(title: nil, content: "Have a nice evening") }
763763
ensure
764-
Reply.reset_callbacks(:validate)
764+
Reply.clear_validators!
765765
end
766766

767767
def test_destroyed_returns_boolean

activerecord/test/cases/validations/i18n_generate_message_validation_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class I18nGenerateMessageValidationTest < ActiveRecord::TestCase
55
def setup
6-
Topic.reset_callbacks(:validate)
6+
Topic.clear_validators!
77
@topic = Topic.new
88
I18n.backend = I18n::Backend::Simple.new
99
end

0 commit comments

Comments
 (0)