diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-05 21:05:50 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-05 21:12:19 +0900 |
commit | db94f492c099db89746f945a522aa7e59ede97cb (patch) | |
tree | 77b6cc694e5d93b3a3e2e1f70a5e84a46855723e /activerecord | |
parent | 5083f3fd602ba5fab6df267261a37b48fd6673b0 (diff) | |
download | rails-db94f492c099db89746f945a522aa7e59ede97cb.tar.gz rails-db94f492c099db89746f945a522aa7e59ede97cb.tar.bz2 rails-db94f492c099db89746f945a522aa7e59ede97cb.zip |
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.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/tasks/database_tasks_test.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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 |