mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-09 17:15:18 +00:00
Move streaming around
config into manager class (#28684)
This commit is contained in:
parent
87097a227c
commit
4e08a4892f
|
@ -107,21 +107,6 @@ RSpec.configure do |config|
|
||||||
Capybara.current_driver = :rack_test
|
Capybara.current_driver = :rack_test
|
||||||
end
|
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|
|
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
|
allow(Resolv::DNS).to receive(:open).and_raise('Real DNS queries are disabled, stub Resolv::DNS as needed') unless example.metadata[:type] == :system
|
||||||
end
|
end
|
||||||
|
|
|
@ -95,6 +95,19 @@ RSpec.configure do |config|
|
||||||
end
|
end
|
||||||
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
|
private
|
||||||
|
|
||||||
def streaming_server_manager
|
def streaming_server_manager
|
||||||
|
|
Loading…
Reference in a new issue