Skip to content

Commit

Permalink
Drop DB connections between integration tests
Browse files Browse the repository at this point in the history
Some tests set up state which is used to initialize connections. If that initialization happens when the pool is populated, the pool will be poisoned with misconfigured connections, and the tests will fail.

Fixes #84.
  • Loading branch information
benlangfeld committed Jan 2, 2024
1 parent b5f7cb6 commit 22d2059
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@
# Cleans up the database before each example, so the current example doesn't
# see the state of the previous one
config.before(:each) do |example|
test_database.setup if example.metadata[:integration]
if example.metadata[:integration]
test_database.setup
ActiveRecord::Base.connection_pool.disconnect!
end
end

config.order = :random
Expand Down

0 comments on commit 22d2059

Please sign in to comment.