From c7b7c6ad1c773102753f1a11b857d0e37ceb6a21 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 29 Mar 2011 15:47:16 -0700 Subject: make sure that active connections are not cleared during test when an exception happens --- .../active_record/connection_adapters/abstract/connection_pool.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters/abstract') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 45900d27dc..b4db1eed18 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -443,11 +443,13 @@ module ActiveRecord end def call(env) + testing = env.key?('rack.test') + status, headers, body = @app.call(env) - [status, headers, Proxy.new(body, env.key?('rack.test'))] + [status, headers, Proxy.new(body, testing)] rescue - ActiveRecord::Base.clear_active_connections! + ActiveRecord::Base.clear_active_connections! unless testing raise end end -- cgit v1.2.3