diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-11-29 14:40:37 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-11-29 14:40:37 -0800 |
commit | 29d2040b2992c112ca475a7a56bcd7f2016252ce (patch) | |
tree | 5d3e3937ee4b69f50e60aec18f95dc09dfb34184 /activerecord/test/cases | |
parent | ce3d8d646a7a4077907b1ec2bad5101840d989e5 (diff) | |
download | rails-29d2040b2992c112ca475a7a56bcd7f2016252ce.tar.gz rails-29d2040b2992c112ca475a7a56bcd7f2016252ce.tar.bz2 rails-29d2040b2992c112ca475a7a56bcd7f2016252ce.zip |
AbstractAdapter#close can be called to add the connection back to the
pool.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/connection_adapters/abstract_adapter_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/connection_adapters/abstract_adapter_test.rb b/activerecord/test/cases/connection_adapters/abstract_adapter_test.rb index 962a5b46fd..7af9079b48 100644 --- a/activerecord/test/cases/connection_adapters/abstract_adapter_test.rb +++ b/activerecord/test/cases/connection_adapters/abstract_adapter_test.rb @@ -33,6 +33,22 @@ module ActiveRecord adapter.expire assert !adapter.in_use?, 'adapter is in use' end + + def test_close + pool = ConnectionPool.new(Base::ConnectionSpecification.new({}, nil)) + pool.connections << adapter + adapter.pool = pool + + # Make sure the pool marks the connection in use + assert_equal adapter, pool.connection + assert adapter.in_use? + + # Close should put the adapter back in the pool + adapter.close + assert !adapter.in_use? + + assert_equal adapter, pool.connection + end end end end |