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

count_snippets_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: daacea83833b627263d8af9f1fc426cbbc07d1c4 (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::CountSnippetsMetric, feature_category: :service_ping do
  before_all do
    create(:personal_snippet, created_at: 5.days.ago)
    create(:personal_snippet, created_at: 1.year.ago)

    create(:project_snippet, created_at: 1.year.ago)
    create(:project_snippet, created_at: 5.days.ago)
  end

  context 'with a time_frame of 28 days' do
    let(:expected_value) { 2 }

    it_behaves_like 'a correct instrumented metric value', { time_frame: '28d', data_source: 'database' }
  end

  context 'with a timeframe of all' do
    let(:expected_value) { 4 }

    it_behaves_like 'a correct instrumented metric value', { time_frame: 'all', data_source: 'database' }
  end
end