diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2019-07-19 14:11:27 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-19 14:11:27 +0300 |
commit | 01685eed7674ec841b4249b42f9b350f4a105e4a (patch) | |
tree | 54d710450f9d7a99e6eb9daac4b65efc7bbda6c8 /spec/lib/gitlab/usage_data_counters | |
parent | 550ac6ef823d76a7274b562cd63d2dddafa65b2f (diff) |
Added Usage Data for some Web IDE actions
The actions tracked in the web IDE are:
- creation of commits
- creation of merge requests
- projects loaded
Diffstat (limited to 'spec/lib/gitlab/usage_data_counters')
-rw-r--r-- | spec/lib/gitlab/usage_data_counters/web_ide_counter_spec.rb | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/spec/lib/gitlab/usage_data_counters/web_ide_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/web_ide_counter_spec.rb index fa0cf15e1b2..b5e32d1875f 100644 --- a/spec/lib/gitlab/usage_data_counters/web_ide_counter_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/web_ide_counter_spec.rb @@ -3,19 +3,34 @@ require 'spec_helper' describe Gitlab::UsageDataCounters::WebIdeCounter, :clean_gitlab_redis_shared_state do - describe '.increment_commits_count' do - it 'increments the web ide commits counter by 1' do - expect do - described_class.increment_commits_count - end.to change { described_class.total_commits_count }.by(1) + shared_examples 'counter examples' do + it 'increments counter and return the total count' do + expect(described_class.public_send(total_counter_method)).to eq(0) + + 2.times { described_class.public_send(increment_counter_method) } + + expect(described_class.public_send(total_counter_method)).to eq(2) end end - describe '.total_commits_count' do - it 'returns the total amount of web ide commits' do - 2.times { described_class.increment_commits_count } + describe 'commits counter' do + let(:increment_counter_method) { :increment_commits_count } + let(:total_counter_method) { :total_commits_count } - expect(described_class.total_commits_count).to eq(2) - end + it_behaves_like 'counter examples' + end + + describe 'merge requests counter' do + let(:increment_counter_method) { :increment_merge_requests_count } + let(:total_counter_method) { :total_merge_requests_count } + + it_behaves_like 'counter examples' + end + + describe 'views counter' do + let(:increment_counter_method) { :increment_views_count } + let(:total_counter_method) { :total_views_count } + + it_behaves_like 'counter examples' end end |