summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/usage_data_counters
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/lib/gitlab/usage_data_counters
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/lib/gitlab/usage_data_counters')
-rw-r--r--spec/lib/gitlab/usage_data_counters/search_counter_spec.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/lib/gitlab/usage_data_counters/search_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/search_counter_spec.rb
index 50a9f980dc7..35b0f9a67f4 100644
--- a/spec/lib/gitlab/usage_data_counters/search_counter_spec.rb
+++ b/spec/lib/gitlab/usage_data_counters/search_counter_spec.rb
@@ -3,11 +3,21 @@
require 'spec_helper'
describe Gitlab::UsageDataCounters::SearchCounter, :clean_gitlab_redis_shared_state do
- it 'increments counter and return the total count' do
- expect(described_class.total_navbar_searches_count).to eq(0)
+ shared_examples_for 'usage counter with totals' do |counter|
+ it 'increments counter and returns total count' do
+ expect(described_class.read(counter)).to eq(0)
- 2.times { described_class.increment_navbar_searches_count }
+ 2.times { described_class.count(counter) }
- expect(described_class.total_navbar_searches_count).to eq(2)
+ expect(described_class.read(counter)).to eq(2)
+ end
+ end
+
+ context 'all_searches counter' do
+ it_behaves_like 'usage counter with totals', :all_searches
+ end
+
+ context 'navbar_searches counter' do
+ it_behaves_like 'usage counter with totals', :navbar_searches
end
end