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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-09 12:08:40 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-09 12:08:40 +0300
commit73add99b1f4ce720f1fe00e828fb6991f27af6fb (patch)
tree450d3139cb74b6cea31142d10bd45787db1e2df5 /spec/lib/gitlab/usage_data_counters/track_unique_actions_spec.rb
parent9f182a88ebe19371a3b7e38c92effb7526985171 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/usage_data_counters/track_unique_actions_spec.rb')
-rw-r--r--spec/lib/gitlab/usage_data_counters/track_unique_actions_spec.rb43
1 files changed, 0 insertions, 43 deletions
diff --git a/spec/lib/gitlab/usage_data_counters/track_unique_actions_spec.rb b/spec/lib/gitlab/usage_data_counters/track_unique_actions_spec.rb
deleted file mode 100644
index d86b8a23dc7..00000000000
--- a/spec/lib/gitlab/usage_data_counters/track_unique_actions_spec.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Gitlab::UsageDataCounters::TrackUniqueActions, :clean_gitlab_redis_shared_state do
- let(:time) { Time.zone.now }
- let(:action) { 'example_action' }
-
- def track_action(params)
- described_class.track_action(params)
- end
-
- def count_unique(params)
- described_class.count_unique(params)
- end
-
- context 'tracking an event' do
- context 'when tracking successfully' do
- it 'tracks and counts the events as expected' do
- stub_application_setting(usage_ping_enabled: true)
-
- aggregate_failures do
- expect(track_action(action: action, author_id: 1)).to be_truthy
- expect(track_action(action: action, author_id: 1)).to be_truthy
- expect(track_action(action: action, author_id: 2)).to be_truthy
- expect(track_action(action: action, author_id: 3, time: time - 3.days)).to be_truthy
-
- expect(count_unique(action: action, date_from: time, date_to: Date.today)).to eq(2)
- expect(count_unique(action: action, date_from: time - 5.days, date_to: Date.tomorrow)).to eq(3)
- end
- end
- end
-
- context 'when tracking unsuccessfully' do
- it 'does not track the event' do
- stub_application_setting(usage_ping_enabled: false)
-
- expect(track_action(action: action, author_id: 2)).to be_nil
- expect(count_unique(action: action, date_from: time, date_to: Date.today)).to eq(0)
- end
- end
- end
-end