summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/usage_data_counters/work_item_activity_unique_counter_spec.rb
blob: 2d251017c87539631b24907f82c7e53dcea7fb0d (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter, :clean_gitlab_redis_shared_state do
  let(:user) { build(:user, id: 1) }

  describe '.track_work_item_created_action' do
    subject(:track_event) { described_class.track_work_item_created_action(author: user) }

    let(:event_name) { described_class::WORK_ITEM_CREATED }

    it_behaves_like 'work item unique counter'
  end

  describe '.track_work_item_title_changed_action' do
    subject(:track_event) { described_class.track_work_item_title_changed_action(author: user) }

    let(:event_name) { described_class::WORK_ITEM_TITLE_CHANGED }

    it_behaves_like 'work item unique counter'
  end

  describe '.track_work_item_date_changed_action' do
    subject(:track_event) { described_class.track_work_item_date_changed_action(author: user) }

    let(:event_name) { described_class::WORK_ITEM_DATE_CHANGED }

    it_behaves_like 'work item unique counter'
  end

  describe '.track_work_item_labels_changed_action' do
    subject(:track_event) { described_class.track_work_item_labels_changed_action(author: user) }

    let(:event_name) { described_class::WORK_ITEM_LABELS_CHANGED }

    it_behaves_like 'work item unique counter'
  end
end