aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/connection_adapters/connection_handler_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-03-29 17:38:43 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-03-29 17:38:43 -0700
commit0471fc9f1cf95865a9810b46f1227783fee40ab5 (patch)
tree50c6a1990e7b97b7960a692c9441e686cbcb4902 /activerecord/test/cases/connection_adapters/connection_handler_test.rb
parent28c73f012328c8386acfc608f0dfb1a459dbf170 (diff)
parent58becf116580c37c63b89f4a660ebe293f6e7c4e (diff)
downloadrails-0471fc9f1cf95865a9810b46f1227783fee40ab5.tar.gz
rails-0471fc9f1cf95865a9810b46f1227783fee40ab5.tar.bz2
rails-0471fc9f1cf95865a9810b46f1227783fee40ab5.zip
Merge branch 'master' into zomg
* master: (51 commits) order is not guaranteed by this select, so add an order and call first! oracle stores this with microseconds, so convert to seconds before comparing make sure that active connections are not cleared during test when an exception happens clearing active connections in the ConnectionManagement middleware if an exception happens proxy body responses so we close database connections after body is flushed Pass the proper method_name instead of hardcoding to action_name. Quote find_in_batches ORDER BY clause [#6620 state:resolved] Delegate first!, last!, any? and many? to scoped Dont call authenticate_or_request_with_http_basic twice Remove 'warning: ambiguous first argument' when running ActionPack tests Change exists? so that it doesn't instantiate records [#6127 state:resolved] Move mapper_test to the appropriate location Update the wildcard route to be non-greedy by default, therefore be able to match the (.:format) segment [#6605 state:resolved] Fix examples Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call [DHH] make sure we have an active database connection before running each connection management test adding active_connections? to the connection pool for finding open connections adding active_connection? to the connection pool testing app delegation from the ConnectionManagement middleware namespacing connection management tests. :heart: ...
Diffstat (limited to 'activerecord/test/cases/connection_adapters/connection_handler_test.rb')
-rw-r--r--activerecord/test/cases/connection_adapters/connection_handler_test.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
new file mode 100644
index 0000000000..abf317768f
--- /dev/null
+++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
@@ -0,0 +1,33 @@
+require "cases/helper"
+
+module ActiveRecord
+ module ConnectionAdapters
+ class ConnectionHandlerTest < ActiveRecord::TestCase
+ def setup
+ @handler = ConnectionHandler.new
+ @handler.establish_connection 'america', Base.connection_pool.spec
+ @klass = Struct.new(:name).new('america')
+ end
+
+ def test_retrieve_connection
+ assert @handler.retrieve_connection(@klass)
+ end
+
+ def test_active_connections?
+ assert !@handler.active_connections?
+ assert @handler.retrieve_connection(@klass)
+ assert @handler.active_connections?
+ @handler.clear_active_connections!
+ assert !@handler.active_connections?
+ end
+
+ def test_retrieve_connection_pool_with_ar_base
+ assert_nil @handler.retrieve_connection_pool(ActiveRecord::Base)
+ end
+
+ def test_retrieve_connection_pool
+ assert_not_nil @handler.retrieve_connection_pool(@klass)
+ end
+ end
+ end
+end