aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb6
1 files changed, 4 insertions, 2 deletions
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