aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2014-08-14 16:10:29 +0900
committerAkira Matsuda <ronnie@dio.jp>2014-08-14 16:14:02 +0900
commite76379b04a0934c5d65d3b04fb00fa3b8221c70f (patch)
tree097235a8ba74643a7a8d3a5dbd4a26e7f9ceba0e
parent9c91c168abeaacc3fc813d1f60b86d615560e266 (diff)
downloadrails-e76379b04a0934c5d65d3b04fb00fa3b8221c70f.tar.gz
rails-e76379b04a0934c5d65d3b04fb00fa3b8221c70f.tar.bz2
rails-e76379b04a0934c5d65d3b04fb00fa3b8221c70f.zip
Clear validators before and after each test
Or some tests fail when run in random order
-rw-r--r--activerecord/test/cases/validations/i18n_validation_test.rb1
-rw-r--r--activerecord/test/cases/validations_repair_helper.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/cases/validations/i18n_validation_test.rb b/activerecord/test/cases/validations/i18n_validation_test.rb
index 3db742c15b..268d7914b5 100644
--- a/activerecord/test/cases/validations/i18n_validation_test.rb
+++ b/activerecord/test/cases/validations/i18n_validation_test.rb
@@ -6,6 +6,7 @@ class I18nValidationTest < ActiveRecord::TestCase
repair_validations(Topic, Reply)
def setup
+ repair_validations(Topic, Reply)
Reply.validates_presence_of(:title)
@topic = Topic.new
@old_load_path, @old_backend = I18n.load_path.dup, I18n.backend
diff --git a/activerecord/test/cases/validations_repair_helper.rb b/activerecord/test/cases/validations_repair_helper.rb
index c02b3241cd..2bbf0f23b3 100644
--- a/activerecord/test/cases/validations_repair_helper.rb
+++ b/activerecord/test/cases/validations_repair_helper.rb
@@ -13,7 +13,7 @@ module ActiveRecord
end
def repair_validations(*model_classes)
- yield
+ yield if block_given?
ensure
model_classes.each do |k|
k.clear_validators!