Sha256: 8084d0548fb3320038f519aa16238e80949b7cc1502496dc9d34e4cead3792bc
Contents?: true
Size: 818 Bytes
Versions: 2
Compression:
Stored size: 818 Bytes
Contents
module NdrDevSupport module IntegrationTesting # Capybara starts another rails application in a new thread # to test against. For transactional fixtures to work, we need # to share the database connection between threads. # # Derived from: https://gist.github.com/josevalim/470808 # # Modified to support multiple connection pools # module ConnectionSharing def self.prepended(base) base.mattr_accessor :shared_connections base.shared_connections = {} base.singleton_class.prepend(ClassMethods) end module ClassMethods def connection shared_connections[connection_config] ||= retrieve_connection end end end end end ActiveRecord::Base.prepend(NdrDevSupport::IntegrationTesting::ConnectionSharing)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ndr_dev_support-1.3.0 | lib/ndr_dev_support/integration_testing/connection_sharing.rb |
ndr_dev_support-1.2.1 | lib/ndr_dev_support/integration_testing/connection_sharing.rb |