diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/services/system_notes | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/services/system_notes')
-rw-r--r-- | spec/services/system_notes/time_tracking_service_spec.rb | 91 |
1 files changed, 73 insertions, 18 deletions
diff --git a/spec/services/system_notes/time_tracking_service_spec.rb b/spec/services/system_notes/time_tracking_service_spec.rb index 33608deaa64..c856caa3f3e 100644 --- a/spec/services/system_notes/time_tracking_service_spec.rb +++ b/spec/services/system_notes/time_tracking_service_spec.rb @@ -48,12 +48,6 @@ RSpec.describe ::SystemNotes::TimeTrackingService do expect(note.note).to eq("changed due date to #{due_date.to_s(:long)}") end - it 'tracks the issue event in usage ping' do - expect(activity_counter_class).to receive(activity_counter_method).with(author: author) - - subject - end - context 'and start date removed' do let(:changed_dates) { { 'due_date' => [nil, due_date], 'start_date' => [start_date, nil] } } @@ -66,12 +60,18 @@ RSpec.describe ::SystemNotes::TimeTrackingService do context 'when start_date is added' do let(:changed_dates) { { 'start_date' => [nil, start_date] } } - it 'does not track the issue event in usage ping' do + it 'does not track the issue event' do expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).not_to receive(:track_issue_due_date_changed_action) subject end + it 'does not emit snowplow event', :snowplow do + expect_no_snowplow_event + + subject + end + it 'sets the correct note message' do expect(note.note).to eq("changed start date to #{start_date.to_s(:long)}") end @@ -111,12 +111,19 @@ RSpec.describe ::SystemNotes::TimeTrackingService do subject end - it 'tracks the issue event in usage ping' do - expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).to receive(:track_issue_due_date_changed_action).with(author: author) + it 'tracks the issue event' do + expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).to receive(:track_issue_due_date_changed_action) + .with(author: author, project: project) subject end + it_behaves_like 'issue_edit snowplow tracking' do + let(:property) { Gitlab::UsageDataCounters::IssueActivityUniqueCounter::ISSUE_DUE_DATE_CHANGED } + let(:user) { author } + subject(:service_action) { note } + end + context 'when only start_date is added' do let(:changed_dates) { { 'start_date' => [nil, start_date] } } @@ -135,12 +142,18 @@ RSpec.describe ::SystemNotes::TimeTrackingService do it_behaves_like 'issuable getting date change notes' - it 'does not track the issue event in usage ping' do + it 'does not track the issue event' do expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).not_to receive(:track_issue_due_date_changed_action) subject end + it 'does not emit snowplow event', :snowplow do + expect_no_snowplow_event + + subject + end + context 'when only start_date is added' do let(:changed_dates) { { 'start_date' => [nil, start_date] } } @@ -155,12 +168,23 @@ RSpec.describe ::SystemNotes::TimeTrackingService do context 'when noteable is a merge request' do let(:noteable) { create(:merge_request, source_project: project) } - it 'does not track the issue event in usage ping' do + it 'does not track the issue event' do expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).not_to receive(:track_issue_due_date_changed_action) + + subject + end + + it 'does not track the work item event in usage ping' do expect(Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter).not_to receive(:track_work_item_date_changed_action) subject end + + it 'does not emit snowplow event', :snowplow do + expect_no_snowplow_event + + subject + end end end @@ -201,17 +225,31 @@ RSpec.describe ::SystemNotes::TimeTrackingService do end it 'tracks the issue event in usage ping' do - expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).to receive(:track_issue_time_estimate_changed_action).with(author: author) + expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).to receive(:track_issue_time_estimate_changed_action) + .with(author: author, project: project) subject end + + it_behaves_like 'issue_edit snowplow tracking' do + let(:property) { Gitlab::UsageDataCounters::IssueActivityUniqueCounter::ISSUE_TIME_ESTIMATE_CHANGED } + let(:user) { author } + let(:service_action) { subject } + end end context 'when noteable is a merge request' do let_it_be(:noteable) { create(:merge_request, source_project: project) } - it 'does not track the issue event in usage ping' do - expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).not_to receive(:track_issue_time_estimate_changed_action).with(author: author) + it 'does not track the issue event' do + expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).not_to receive(:track_issue_time_estimate_changed_action) + .with(author: author, project: project) + + subject + end + + it 'does not emit snowplow event', :snowplow do + expect_no_snowplow_event subject end @@ -316,25 +354,42 @@ RSpec.describe ::SystemNotes::TimeTrackingService do end end - it 'tracks the issue event in usage ping' do - expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).to receive(:track_issue_time_spent_changed_action).with(author: author) + it 'tracks the issue event' do + expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).to receive(:track_issue_time_spent_changed_action) + .with(author: author, project: project) spend_time!(277200) subject end + + it_behaves_like 'issue_edit snowplow tracking' do + let(:property) { Gitlab::UsageDataCounters::IssueActivityUniqueCounter::ISSUE_TIME_SPENT_CHANGED } + let(:user) { author } + let(:service_action) do + spend_time!(277200) + subject + end + end end context 'when noteable is a merge request' do let_it_be(:noteable) { create(:merge_request, source_project: project) } - it 'does not track the issue event in usage ping' do - expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).not_to receive(:track_issue_time_estimate_changed_action).with(author: author) + it 'does not track the issue event' do + expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).not_to receive(:track_issue_time_estimate_changed_action) + .with(author: author, project: project) spend_time!(277200) subject end + + it 'does not emit snowplow event', :snowplow do + expect_no_snowplow_event + + subject + end end def spend_time!(seconds) |