Sha256: 4ffc4846700cfc2130c1e7f5cd399f08effe06d3e0ee44519124d680e2ec956d

Contents?: true

Size: 385 Bytes

Versions: 30

Compression:

Stored size: 385 Bytes

Contents

# In your test_helper.rb
class ActiveRecord::Base
  mattr_accessor :shared_connection
  @@shared_connection = nil

  def self.connection
    @@shared_connection || retrieve_connection
  end
end

# Forces all threads to share the same connection. This works on
# Capybara because it starts the web server in a thread.
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
message_train-0.4.6 spec/support/shared_connection.rb
message_train-0.4.5 spec/support/shared_connection.rb
message_train-0.4.4 spec/support/shared_connection.rb
message_train-0.4.3 spec/support/shared_connection.rb
message_train-0.4.2 spec/support/shared_connection.rb
message_train-0.4.1 spec/support/shared_connection.rb
message_train-0.4.0 spec/support/shared_connection.rb
message_train-0.3.1 spec/support/shared_connection.rb
message_train-0.3.0 spec/support/shared_connection.rb
message_train-0.2.12 spec/support/shared_connection.rb
message_train-0.2.11 spec/support/shared_connection.rb
message_train-0.2.10 spec/support/shared_connection.rb
message_train-0.2.9 spec/support/shared_connection.rb
message_train-0.2.8 spec/support/shared_connection.rb
message_train-0.2.7 spec/support/shared_connection.rb
message_train-0.2.6 spec/support/shared_connection.rb
message_train-0.2.5 spec/support/shared_connection.rb
message_train-0.2.4 spec/support/shared_connection.rb
message_train-0.2.3 spec/support/shared_connection.rb
message_train-0.2.2 spec/support/shared_connection.rb