diff options
Diffstat (limited to 'spec/lib/gitlab/usage_data_counters/search_counter_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage_data_counters/search_counter_spec.rb | 18 |
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 |