f95fa7145b
- Use multiple threads / database connections to: 1. Escape the transaction the spec seems to be running in (`config.use_transactional_fixtures` is off, but `ActiveRecord::Base.connection.open_transactions` is not empty at the beginning of the spec. 2. Simulate a Sidekiq worker performing the hard delete outside of the soft-delete transaction. - The spec is a little clunky, but it was the smallest thing I could get working - and even this took a couple of hours. Let me know if you have any suggestions to improve it!
9 lines
200 B
Ruby
9 lines
200 B
Ruby
module DatabaseConnectionHelpers
|
|
def run_with_new_database_connection
|
|
pool = ActiveRecord::Base.connection_pool
|
|
conn = pool.checkout
|
|
yield conn
|
|
ensure
|
|
pool.checkin(conn)
|
|
end
|
|
end
|