1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/validations_repair_helper.rb
2017-07-19 22:27:07 +03:00

21 lines
435 B
Ruby

# frozen_string_literal: true
module ActiveRecord
module ValidationsRepairHelper
extend ActiveSupport::Concern
module ClassMethods
def repair_validations(*model_classes)
teardown do
model_classes.each(&:clear_validators!)
end
end
end
def repair_validations(*model_classes)
yield if block_given?
ensure
model_classes.each(&:clear_validators!)
end
end
end