diff options
Diffstat (limited to 'spec/support/gitlab/usage/metrics_instrumentation_shared_examples.rb')
-rw-r--r-- | spec/support/gitlab/usage/metrics_instrumentation_shared_examples.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/support/gitlab/usage/metrics_instrumentation_shared_examples.rb b/spec/support/gitlab/usage/metrics_instrumentation_shared_examples.rb new file mode 100644 index 00000000000..c9ff566e94c --- /dev/null +++ b/spec/support/gitlab/usage/metrics_instrumentation_shared_examples.rb @@ -0,0 +1,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 |