summaryrefslogtreecommitdiff
path: root/spec/support/database/query_analyzer.rb
blob: 6d6627d54b90312caea2cb3376f89e72fb0de279 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

# With the usage of `describe '...', query_analyzers: false`
# can be disabled selectively

RSpec.configure do |config|
  config.before do |example|
    if example.metadata.fetch(:query_analyzers, true)
      ::Gitlab::Database::QueryAnalyzer.instance.begin!
    end
  end

  config.after do |example|
    if example.metadata.fetch(:query_analyzers, true)
      ::Gitlab::Database::QueryAnalyzer.instance.end!
    end
  end
end