diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/services/notes/create_service_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/services/notes/create_service_spec.rb')
-rw-r--r-- | spec/services/notes/create_service_spec.rb | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb index b0410123630..c72a9465f20 100644 --- a/spec/services/notes/create_service_spec.rb +++ b/spec/services/notes/create_service_spec.rb @@ -168,7 +168,6 @@ RSpec.describe Notes::CreateService do before do project_with_repo.add_maintainer(user) end - context 'when eligible to have a note diff file' do let(:new_opts) do opts.merge(in_reply_to_discussion_id: nil, @@ -196,6 +195,39 @@ RSpec.describe Notes::CreateService do described_class.new(project_with_repo, user, new_opts).execute(skip_capture_diff_note_position: true) end end + + it 'does not track ipynb note usage data' do + expect(::Gitlab::UsageDataCounters::IpynbDiffActivityCounter).not_to receive(:note_created) + + described_class.new(project_with_repo, user, new_opts).execute + end + + context 'is ipynb file' do + before do + allow_any_instance_of(::Gitlab::Diff::File).to receive(:ipynb?).and_return(true) + stub_feature_flags(ipynbdiff_notes_tracker: false) + end + + context ':ipynbdiff_notes_tracker is off' do + it 'does not track ipynb note usage data' do + expect(::Gitlab::UsageDataCounters::IpynbDiffActivityCounter).not_to receive(:note_created) + + described_class.new(project_with_repo, user, new_opts).execute + end + end + + context ':ipynbdiff_notes_tracker is on' do + before do + stub_feature_flags(ipynbdiff_notes_tracker: true) + end + + it 'tracks ipynb diff note creation' do + expect(::Gitlab::UsageDataCounters::IpynbDiffActivityCounter).to receive(:note_created) + + described_class.new(project_with_repo, user, new_opts).execute + end + end + end end context 'when DiffNote is a reply' do |