fix "Mysql2::Error: This connection is in use by" in spec for Rails 4

Conflicts:
	Gemfile
	Gemfile.lock
This commit is contained in:
wvengen 2013-12-07 15:10:13 +01:00
parent 2de4a2a3a0
commit e88810e4a7
3 changed files with 4 additions and 1 deletions

View File

@ -86,6 +86,7 @@ group :test do
# webkit and poltergeist don't seem to work yet
gem 'selenium-webdriver'
gem 'database_cleaner'
gem 'connection_pool'
# need to include rspec components before i18n-spec or rake fails in test environment
gem 'rspec-core'
gem 'rspec-expectations'

View File

@ -114,6 +114,7 @@ GEM
execjs
coffee-script-source (1.6.3)
commonjs (0.2.7)
connection_pool (1.2.0)
content_for_in_controllers (0.0.2)
coveralls (0.7.0)
multi_json (~> 1.3)
@ -387,6 +388,7 @@ DEPENDENCIES
client_side_validations
client_side_validations-simple_form
coffee-rails (~> 3.2.1)
connection_pool
coveralls
daemons
database_cleaner

View File

@ -5,7 +5,7 @@ class ActiveRecord::Base
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
end
end
# Forces all threads to share the same connection. This works on