Commit 835cc3bc authored by Heinrich Lee Yu's avatar Heinrich Lee Yu Committed by Eugenia Grieff

Fix notes create service spec

These tests require a persisted noteable
parent bba75738
...@@ -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