@@ -121,8 +121,9 @@ def new_application
121121
122122 # (Test) Helpers :
123123
124- def create_schema_migrations_table ( connection = ActiveRecord ::Base . connection )
125- schema_migration = connection . schema_migration
124+ def create_schema_migrations_table
125+ pool = ActiveRecord ::Base . connection_pool
126+ schema_migration = pool . schema_migration
126127
127128 return if schema_migration . table_exists?
128129
@@ -133,26 +134,26 @@ def create_schema_migrations_table(connection = ActiveRecord::Base.connection)
133134
134135 def create_rake_test_database
135136 ActiveRecord ::Base . establish_connection db_config
136- connection = ActiveRecord ::Base . connection
137+ connection = ActiveRecord ::Base . lease_connection
137138 connection . create_database ( db_name , db_config ) if connection . respond_to? ( :create_database )
138139 if block_given?
139140 if db_name
140141 config = db_config . merge :database => db_name
141142 ActiveRecord ::Base . establish_connection config
142143 end
143- yield ActiveRecord ::Base . connection
144+ yield ActiveRecord ::Base . lease_connection
144145 end
145- ActiveRecord ::Base . connection . disconnect!
146+ ActiveRecord ::Base . lease_connection . disconnect!
146147 end
147148
148149 def drop_rake_test_database ( silence = false )
149150 ActiveRecord ::Base . establish_connection db_config
150151 begin
151- ActiveRecord ::Base . connection . drop_database ( db_name )
152+ ActiveRecord ::Base . lease_connection . drop_database ( db_name )
152153 rescue => e
153154 raise e unless silence
154155 end
155- ActiveRecord ::Base . connection . disconnect!
156+ ActiveRecord ::Base . lease_connection . disconnect!
156157 end
157158
158159 def structure_sql_filename
0 commit comments