Commit 28eb2562 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'fix-notes-create-service-spec' into 'master'

Use parent strategy for associations in factories - Notes Create Service spec

See merge request gitlab-org/gitlab!41356
parents a0d1a09a 835cc3bc
...@@ -41,7 +41,7 @@ RSpec.describe Notes::CreateService do ...@@ -41,7 +41,7 @@ RSpec.describe Notes::CreateService do
end end
it 'TodoService#new_note is called' do it 'TodoService#new_note is called' do
note = build(:note, project: project) note = build(:note, project: project, noteable: issue)
allow(Note).to receive(:new).with(opts) { note } allow(Note).to receive(:new).with(opts) { note }
expect_any_instance_of(TodoService).to receive(:new_note).with(note, user) expect_any_instance_of(TodoService).to receive(:new_note).with(note, user)
...@@ -50,7 +50,7 @@ RSpec.describe Notes::CreateService do ...@@ -50,7 +50,7 @@ RSpec.describe Notes::CreateService do
end end
it 'enqueues NewNoteWorker' do it 'enqueues NewNoteWorker' do
note = build(:note, id: non_existing_record_id, project: project) note = build(:note, id: non_existing_record_id, project: project, noteable: issue)
allow(Note).to receive(:new).with(opts) { note } allow(Note).to receive(:new).with(opts) { note }
expect(NewNoteWorker).to receive(:perform_async).with(note.id) expect(NewNoteWorker).to receive(:perform_async).with(note.id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment