Commit ec31fa26 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Avoid using expect_any_instance_of

We can't use it for prepended module, so use
`and_wrap_original` to wrap around the instance.
parent acdb7435
...@@ -18,8 +18,13 @@ describe UpdateMergeRequestsWorker do ...@@ -18,8 +18,13 @@ describe UpdateMergeRequestsWorker do
end end
it 'executes MergeRequests::RefreshService with expected values' do it 'executes MergeRequests::RefreshService with expected values' do
expect(MergeRequests::RefreshService).to receive(:new).with(project, user).and_call_original expect(MergeRequests::RefreshService).to receive(:new)
expect_any_instance_of(MergeRequests::RefreshService).to receive(:execute).with(oldrev, newrev, ref) .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 perform
end end
......
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