debian-mirror-gitlab/spec/support/database/query_analyzer.rb

19 lines
459 B
Ruby
Raw Normal View History

2021-12-11 22:18:48 +05:30
# frozen_string_literal: true
# With the usage of `describe '...', query_analyzers: false`
# can be disabled selectively
RSpec.configure do |config|
2022-01-26 12:08:38 +05:30
config.before do |example|
2021-12-11 22:18:48 +05:30
if example.metadata.fetch(:query_analyzers, true)
2022-01-26 12:08:38 +05:30
::Gitlab::Database::QueryAnalyzer.instance.begin!
end
end
config.after do |example|
if example.metadata.fetch(:query_analyzers, true)
::Gitlab::Database::QueryAnalyzer.instance.end!
2021-12-11 22:18:48 +05:30
end
end
end