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:
Diffstat (limited to 'spec/lib/gitlab/usage_data_counters/redis_counter_spec.rb')
-rw-r--r--spec/lib/gitlab/usage_data_counters/redis_counter_spec.rb48
1 files changed, 8 insertions, 40 deletions
diff --git a/spec/lib/gitlab/usage_data_counters/redis_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/redis_counter_spec.rb
index 753e09731bf..39d48b7b938 100644
--- a/spec/lib/gitlab/usage_data_counters/redis_counter_spec.rb
+++ b/spec/lib/gitlab/usage_data_counters/redis_counter_spec.rb
@@ -7,51 +7,19 @@ RSpec.describe Gitlab::UsageDataCounters::RedisCounter, :clean_gitlab_redis_shar
subject { Class.new.extend(described_class) }
- before do
- allow(::ServicePing::ServicePingSettings).to receive(:enabled?).and_return(service_ping_enabled)
- end
-
describe '.increment' do
- context 'when usage_ping is disabled' do
- let(:service_ping_enabled) { false }
-
- it 'counter is not increased' do
- expect do
- subject.increment(redis_key)
- end.not_to change { subject.total_count(redis_key) }
- end
- end
-
- context 'when usage_ping is enabled' do
- let(:service_ping_enabled) { true }
-
- it 'counter is increased' do
- expect do
- subject.increment(redis_key)
- end.to change { subject.total_count(redis_key) }.by(1)
- end
+ it 'counter is increased' do
+ expect do
+ subject.increment(redis_key)
+ end.to change { subject.total_count(redis_key) }.by(1)
end
end
describe '.increment_by' do
- context 'when usage_ping is disabled' do
- let(:service_ping_enabled) { false }
-
- it 'counter is not increased' do
- expect do
- subject.increment_by(redis_key, 3)
- end.not_to change { subject.total_count(redis_key) }
- end
- end
-
- context 'when usage_ping is enabled' do
- let(:service_ping_enabled) { true }
-
- it 'counter is increased' do
- expect do
- subject.increment_by(redis_key, 3)
- end.to change { subject.total_count(redis_key) }.by(3)
- end
+ it 'counter is increased' do
+ expect do
+ subject.increment_by(redis_key, 3)
+ end.to change { subject.total_count(redis_key) }.by(3)
end
end
end