From 25fb2db409f30437d901bf644b7cdea39ce64fdb Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 13 Mar 2006 17:28:55 +0000 Subject: Dynamically set allow_concurrency. Closes #4044. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3862 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/threaded_connections_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/test/threaded_connections_test.rb') diff --git a/activerecord/test/threaded_connections_test.rb b/activerecord/test/threaded_connections_test.rb index 177c6c7e13..d9cc47eef3 100644 --- a/activerecord/test/threaded_connections_test.rb +++ b/activerecord/test/threaded_connections_test.rb @@ -9,6 +9,16 @@ class ThreadedConnectionsTest < Test::Unit::TestCase def setup @connection = ActiveRecord::Base.remove_connection @connections = [] + @allow_concurrency = ActiveRecord::Base.allow_concurrency + end + + def teardown + # clear the connection cache + ActiveRecord::Base.send(:clear_all_cached_connections!) + # set allow_concurrency to saved value + ActiveRecord::Base.allow_concurrency = @allow_concurrency + # reestablish old connection + ActiveRecord::Base.establish_connection(@connection) end def gather_connections(use_threaded_connections) -- cgit v1.2.3