Welcome to mirror list, hosted at ThFree Co, Russian Federation.

merge_request_widget_extension_metric_spec.rb « instrumentations « metrics « usage « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c0ac00c9cdd94c9bf3ee5ee2a0700aae9459417d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Usage::Metrics::Instrumentations::MergeRequestWidgetExtensionMetric,
  :clean_gitlab_redis_shared_state do
  before do
    4.times do
      Gitlab::UsageDataCounters::MergeRequestWidgetExtensionCounter.count(:terraform_count_expand)
    end
  end

  let(:expected_value) { 4 }

  it_behaves_like 'a correct instrumented metric value', {
    options: { event: 'expand', widget: 'terraform' },
    time_frame: 'all'
  }

  it 'raises an exception if widget option is not present' do
    expect do
      described_class.new(options: { event: 'expand' }, time_frame: 'all')
    end.to raise_error(ArgumentError, /'widget' option is required/)
  end
end