From db94f492c099db89746f945a522aa7e59ede97cb Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 5 Mar 2019 21:05:50 +0900 Subject: [PATCH] Reset `connection_handlers` to default when any test dirties that Most existing tests expects `connection_handlers` has only one default handler, but the test added at #34779 dirties that. We need to reset `connection_handlers` to default in that case. Closes #35471. --- activerecord/test/cases/tasks/database_tasks_test.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/activerecord/test/cases/tasks/database_tasks_test.rb b/activerecord/test/cases/tasks/database_tasks_test.rb index 696003fcb8..06f11108f9 100644 --- a/activerecord/test/cases/tasks/database_tasks_test.rb +++ b/activerecord/test/cases/tasks/database_tasks_test.rb @@ -951,6 +951,10 @@ module ActiveRecord fixtures :authors, :author_addresses + def teardown + ActiveRecord::Base.connection_handlers = { writing: ActiveRecord::Base.default_connection_handler } + end + def test_truncate_tables assert_operator Author.count, :>, 0 assert_operator AuthorAddress.count, :>, 0