summaryrefslogtreecommitdiff
path: root/spec/support/gitlab/usage/metrics_instrumentation_shared_examples.rb
blob: c9ff566e94c920ea389ad3eda65eb921ae211e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

RSpec.shared_examples 'a correct instrumented metric value' do |options, expected_value|
  let(:time_frame) { options[:time_frame] }

  before do
    allow(ActiveRecord::Base.connection).to receive(:transaction_open?).and_return(false)
  end

  it 'has correct value' do
    expect(described_class.new(time_frame: time_frame).value).to eq(expected_value)
  end
end