1
0
mirror of https://github.com/funamitech/mastodon synced 2024-11-27 22:38:42 +09:00

Move streaming around config into manager class (#28684)

This commit is contained in:
Matt Jankowski 2024-01-11 05:54:42 -05:00 committed by GitHub
parent 87097a227c
commit 4e08a4892f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 15 deletions

View File

@ -107,21 +107,6 @@ RSpec.configure do |config|
Capybara.current_driver = :rack_test
end
config.around :each, type: :system do |example|
# The streaming server needs access to the database
# but with use_transactional_tests every transaction
# is rolled-back, so the streaming server never sees the data
# So we disable this feature for system tests, and use DatabaseCleaner to clean
# the database tables between each test
self.use_transactional_tests = false
DatabaseCleaner.cleaning do
example.run
end
self.use_transactional_tests = true
end
config.before do |example|
allow(Resolv::DNS).to receive(:open).and_raise('Real DNS queries are disabled, stub Resolv::DNS as needed') unless example.metadata[:type] == :system
end

View File

@ -95,6 +95,19 @@ RSpec.configure do |config|
end
end
config.around :each, type: :system do |example|
# Streaming server needs DB access but `use_transactional_tests` rolls back
# every transaction. Disable this feature for streaming tests, and use
# DatabaseCleaner to clean the database tables between each test.
self.use_transactional_tests = false
DatabaseCleaner.cleaning do
example.run
end
self.use_transactional_tests = true
end
private
def streaming_server_manager