aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/pooled_connections_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/pooled_connections_test.rb')
-rw-r--r--activerecord/test/cases/pooled_connections_test.rb24
1 files changed, 20 insertions, 4 deletions
diff --git a/activerecord/test/cases/pooled_connections_test.rb b/activerecord/test/cases/pooled_connections_test.rb
index 078ca1d679..2649a9358a 100644
--- a/activerecord/test/cases/pooled_connections_test.rb
+++ b/activerecord/test/cases/pooled_connections_test.rb
@@ -28,10 +28,13 @@ class PooledConnectionsTest < ActiveRecord::TestCase
end
end
- def test_pooled_connection_checkout
- checkout_connections
- assert_equal @connections.length, 2
- assert_equal @timed_out, 2
+ # Will deadlock due to lack of Monitor timeouts in 1.9
+ if RUBY_VERSION < '1.9'
+ def test_pooled_connection_checkout
+ checkout_connections
+ assert_equal @connections.length, 2
+ assert_equal @timed_out, 2
+ end
end
def checkout_checkin_connections(pool_size, threads)
@@ -73,6 +76,19 @@ class PooledConnectionsTest < ActiveRecord::TestCase
assert ActiveRecord::ConnectionAdapters::AbstractAdapter === conn
conn_pool.checkin(conn)
end
+
+ def test_not_connected_defined_connection_returns_false
+ ActiveRecord::Base.establish_connection(@connection)
+ assert ! ActiveRecord::Base.connected?
+ end
+
+ def test_undefined_connection_returns_false
+ old_handler = ActiveRecord::Base.connection_handler
+ ActiveRecord::Base.connection_handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new
+ assert_equal false, ActiveRecord::Base.connected?
+ ensure
+ ActiveRecord::Base.connection_handler = old_handler
+ end
end unless %w(FrontBase).include? ActiveRecord::Base.connection.adapter_name
class AllowConcurrencyDeprecatedTest < ActiveRecord::TestCase