diff options
Diffstat (limited to 'activerecord/test/cases/validations_repair_helper.rb')
-rw-r--r-- | activerecord/test/cases/validations_repair_helper.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/activerecord/test/cases/validations_repair_helper.rb b/activerecord/test/cases/validations_repair_helper.rb new file mode 100644 index 0000000000..11912ca1cc --- /dev/null +++ b/activerecord/test/cases/validations_repair_helper.rb @@ -0,0 +1,23 @@ +module ActiveRecord + module ValidationsRepairHelper + extend ActiveSupport::Concern + + module ClassMethods + def repair_validations(*model_classes) + teardown do + model_classes.each do |k| + k.reset_callbacks(:validate) + end + end + end + end + + def repair_validations(*model_classes) + yield + ensure + model_classes.each do |k| + k.reset_callbacks(:validate) + end + end + end +end |