From b1375ef44ed89e7ca7d5aaaefd3778604a139b51 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 29 Nov 2017 20:57:13 +0800 Subject: [PATCH] Ensure that we disconnect connection in test. --- .../postgresql_fallback_adapter_spec.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb b/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb index 8e2ee7d9004..4fd198095d1 100644 --- a/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb +++ b/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb @@ -41,8 +41,14 @@ describe ActiveRecord::ConnectionHandling do describe "#postgresql_fallback_connection" do it 'should return a PostgreSQL adapter' do - expect(ActiveRecord::Base.postgresql_fallback_connection(config)) - .to be_an_instance_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) + begin + connection = ActiveRecord::Base.postgresql_fallback_connection(config) + + expect(connection) + .to be_an_instance_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) + ensure + connection.disconnect! + end end context 'when master server is down' do