Convert use of any_instance as it does not work with prepend

This commit is contained in:
Mark Chao 2018-07-19 10:43:17 +08:00
parent bd6f1ceb27
commit 35e029009d
2 changed files with 6 additions and 2 deletions

View File

@ -145,7 +145,9 @@ describe Notes::CreateService do
let(:note_text) { %(HELLO\n/close\n/assign @#{user.username}\nWORLD) }
it 'saves the note and does not alter the note text' do
expect_any_instance_of(Issues::UpdateService).to receive(:execute).and_call_original
service = double(:service)
allow(Issues::UpdateService).to receive(:new).and_return(service)
expect(service).to receive(:execute)
note = described_class.new(project, user, opts.merge(note: note_text)).execute

View File

@ -4,7 +4,9 @@ shared_examples 'issues move service' do |group|
let(:params) { { board_id: board1.id, from_list_id: list1.id, to_list_id: list2.id } }
it 'delegates the label changes to Issues::UpdateService' do
expect_any_instance_of(Issues::UpdateService).to receive(:execute).with(issue).once
service = double(:service)
expect(Issues::UpdateService).to receive(:new).and_return(service)
expect(service).to receive(:execute).with(issue).once
described_class.new(parent, user, params).execute(issue)
end