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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-28 12:10:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-28 12:10:32 +0300
commitc4b69460e8dd4921eb20fa78b47ceff294d725dc (patch)
tree9be3f5c3913ead9eeb5f183ac7a163b193412967 /spec/workers/new_note_worker_spec.rb
parent540c69c58c9e60f2d9b47987afe5e020593d39ac (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/new_note_worker_spec.rb')
-rw-r--r--spec/workers/new_note_worker_spec.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/workers/new_note_worker_spec.rb b/spec/workers/new_note_worker_spec.rb
index 21f10fa5bfb..76702ee0ffc 100644
--- a/spec/workers/new_note_worker_spec.rb
+++ b/spec/workers/new_note_worker_spec.rb
@@ -50,10 +50,20 @@ RSpec.describe NewNoteWorker do
end
end
- context 'when note is with review' do
- it 'does not create a new note notification' do
- note = create(:note, :with_review)
+ context 'when note does not require notification' do
+ let(:note) { create(:note) }
+ before do
+ # TODO: `allow_next_instance_of` helper method is not working
+ # because ActiveRecord is directly calling `.allocate` on model
+ # classes and bypasses the `.new` method call.
+ # Fix the `allow_next_instance_of` helper and change these to mock
+ # the next instance of `Note` model class.
+ allow(Note).to receive(:find_by).with(id: note.id).and_return(note)
+ allow(note).to receive(:skip_notification?).and_return(true)
+ end
+
+ it 'does not create a new note notification' do
expect_any_instance_of(NotificationService).not_to receive(:new_note)
subject.perform(note.id)