Skip to content

Commit f75f280

Browse files
committed
Add ivars that are present in ActiveRecord::TestFixtures to ManagesTransactions
These ivars are normally initialized by `setup_fixtures`, which isn't actually mixed into cypress-rails, because we're piggy-backing on AR's fixture transaction management feature, not actually using fixtures. As a result, this was probably never actually working correctly for applications that spun up >1 connection in their test runs. However, because we bind the connection pool call to self, this should at least get that much working, though without a reproducible test case my confidence that this ever worked as imagined or will start working now is very low. Nevertheless, should clear the error being experienced without impacting anyone for whom this actually is working as intended somehow. Verified these ivars are present thru Rails 6.1.4 Fixes #88 Fixes #89
1 parent e258a24 commit f75f280

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/cypress-rails/manages_transactions.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def gather_connections
6868
# need to share a connection pool so that the reading connection
6969
# can see data in the open transaction on the writing connection.
7070
def setup_shared_connection_pool
71+
@legacy_saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }
72+
@saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }
73+
7174
ActiveRecord::TestFixtures.instance_method(:setup_shared_connection_pool).bind_call(self)
7275
end
7376
end

0 commit comments

Comments
 (0)