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/services/notes/create_service_spec.rb')
-rw-r--r--spec/services/notes/create_service_spec.rb34
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