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

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

  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, options: options).value).to eq(expected_value)
  end
end