mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
e76379b04a
Or some tests fail when run in random order
23 lines
460 B
Ruby
23 lines
460 B
Ruby
module ActiveRecord
|
|
module ValidationsRepairHelper
|
|
extend ActiveSupport::Concern
|
|
|
|
module ClassMethods
|
|
def repair_validations(*model_classes)
|
|
teardown do
|
|
model_classes.each do |k|
|
|
k.clear_validators!
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
def repair_validations(*model_classes)
|
|
yield if block_given?
|
|
ensure
|
|
model_classes.each do |k|
|
|
k.clear_validators!
|
|
end
|
|
end
|
|
end
|
|
end
|