Ensure that we disconnect connection in test.

This commit is contained in:
Guo Xiang Tan 2017-11-29 20:57:13 +08:00
parent fffb7561c4
commit b1375ef44e

View File

@ -41,8 +41,14 @@ describe ActiveRecord::ConnectionHandling do
describe "#postgresql_fallback_connection" do describe "#postgresql_fallback_connection" do
it 'should return a PostgreSQL adapter' do it 'should return a PostgreSQL adapter' do
expect(ActiveRecord::Base.postgresql_fallback_connection(config)) begin
.to be_an_instance_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) connection = ActiveRecord::Base.postgresql_fallback_connection(config)
expect(connection)
.to be_an_instance_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
ensure
connection.disconnect!
end
end end
context 'when master server is down' do context 'when master server is down' do