diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-05-23 13:06:06 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-05-23 15:39:39 +0300 |
commit | ec31fa260b9f438fe7e369c6f61d55c4f10441cc (patch) | |
tree | eed51abeefdec0a383fa62fe57873bcd14246c7d /spec/workers/update_merge_requests_worker_spec.rb | |
parent | acdb7435dadc0b4efbe8da96873383cac4221a97 (diff) |
Avoid using expect_any_instance_of
We can't use it for prepended module, so use
`and_wrap_original` to wrap around the instance.
Diffstat (limited to 'spec/workers/update_merge_requests_worker_spec.rb')
-rw-r--r-- | spec/workers/update_merge_requests_worker_spec.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/workers/update_merge_requests_worker_spec.rb b/spec/workers/update_merge_requests_worker_spec.rb index 0fa19ac84bb..80137815d2b 100644 --- a/spec/workers/update_merge_requests_worker_spec.rb +++ b/spec/workers/update_merge_requests_worker_spec.rb @@ -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 |