aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations/confirmation_validation_test.rb
diff options
context:
space:
mode:
authorZuhao Wan <wanzuhao@gmail.com>2014-03-08 01:59:57 +0800
committerZuhao Wan <wanzuhao@gmail.com>2014-03-10 03:52:51 +0800
commit9ffeb36265928e0fb6de7ffc4b4f3cb3e7fa3581 (patch)
tree45c1d9bdaaf17febc0c42ef611bd75f9b98e7f02 /activemodel/test/cases/validations/confirmation_validation_test.rb
parent70ff31d69f017d1bc674b913865d5a008de0c8a6 (diff)
downloadrails-9ffeb36265928e0fb6de7ffc4b4f3cb3e7fa3581.tar.gz
rails-9ffeb36265928e0fb6de7ffc4b4f3cb3e7fa3581.tar.bz2
rails-9ffeb36265928e0fb6de7ffc4b4f3cb3e7fa3581.zip
Run ActiveModel test suites in random order.
This gets the whole ActiveModel test suites working even if `self.i_suck_and_my_tests_are_order_dependent!` is disabled in `ActiveSupport::TestCase`. Two places are found that potentially leak global state. This patch makes sure states are restored so that none of the changes happen in a single test will be carried over to subsequence tests.
Diffstat (limited to 'activemodel/test/cases/validations/confirmation_validation_test.rb')
-rw-r--r--activemodel/test/cases/validations/confirmation_validation_test.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/activemodel/test/cases/validations/confirmation_validation_test.rb b/activemodel/test/cases/validations/confirmation_validation_test.rb
index 4957ba5d0a..4c3d7a7615 100644
--- a/activemodel/test/cases/validations/confirmation_validation_test.rb
+++ b/activemodel/test/cases/validations/confirmation_validation_test.rb
@@ -63,12 +63,15 @@ class ConfirmationValidationTest < ActiveModel::TestCase
Topic.validates_confirmation_of(:title)
- t = Topic.new("title" => "We should be confirmed","title_confirmation" => "")
- assert t.invalid?
- assert_equal ["doesn't match Test Title"], t.errors[:title_confirmation]
-
- I18n.load_path.replace @old_load_path
- I18n.backend = @old_backend
+ begin
+ t = Topic.new("title" => "We should be confirmed","title_confirmation" => "")
+ assert t.invalid?
+ assert_equal ["doesn't match Test Title"], t.errors[:title_confirmation]
+ ensure
+ I18n.load_path.replace @old_load_path
+ I18n.backend = @old_backend
+ I18n.backend.reload!
+ end
end
test "does not override confirmation reader if present" do