Avoid using expect_any_instance_of
We can't use it for prepended module, so use `and_wrap_original` to wrap around the instance.
This commit is contained in:
parent
acdb7435da
commit
ec31fa260b
|
@ -18,8 +18,13 @@ describe UpdateMergeRequestsWorker do
|
|||
end
|
||||
|
||||
it 'executes MergeRequests::RefreshService with expected values' do
|
||||
expect(MergeRequests::RefreshService).to receive(:new).with(project, user).and_call_original
|
||||
expect_any_instance_of(MergeRequests::RefreshService).to receive(:execute).with(oldrev, newrev, ref)
|
||||
expect(MergeRequests::RefreshService).to receive(:new)
|
||||
.with(project, user).and_wrap_original do |method, *args|
|
||||
method.call(*args).tap do |refresh_service|
|
||||
expect(refresh_service)
|
||||
.to receive(:execute).with(oldrev, newrev, ref)
|
||||
end
|
||||
end
|
||||
|
||||
perform
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue