Module: E2E::Rails::ActiveRecordSharedConnection

Defined in:
lib/e2e/rails.rb

Overview

This module allows the test thread and the server thread to share the same ActiveRecord connection. This is crucial for running tests in transactions which is much faster than using truncation.

Instance Method Summary collapse

Instance Method Details

#connectionObject



9
10
11
# File 'lib/e2e/rails.rb', line 9

def connection
  @shared_connection || retrieve_connection
end

#shared_connection=(connection) ⇒ Object



13
14
15
# File 'lib/e2e/rails.rb', line 13

def shared_connection=(connection)
  @shared_connection = connection
end