Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-11 15:09:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-11 15:09:28 +0300
commit7ca44446277ca15db60b722da28f98f773b8f61a (patch)
tree7622f430d0431df78dfa34f50efc371458cfb97f /spec/workers/merge_requests
parent3ba6a5a16df690246d30bff1038cbed36a16a493 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/merge_requests')
-rw-r--r--spec/workers/merge_requests/delete_source_branch_worker_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/workers/merge_requests/delete_source_branch_worker_spec.rb b/spec/workers/merge_requests/delete_source_branch_worker_spec.rb
index df5773d55c1..957adbbbd6e 100644
--- a/spec/workers/merge_requests/delete_source_branch_worker_spec.rb
+++ b/spec/workers/merge_requests/delete_source_branch_worker_spec.rb
@@ -13,6 +13,7 @@ RSpec.describe MergeRequests::DeleteSourceBranchWorker do
context 'with a non-existing merge request' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
+ expect(::MergeRequests::RetargetChainService).not_to receive(:new)
worker.perform(non_existing_record_id, sha, user.id)
end
@@ -21,6 +22,7 @@ RSpec.describe MergeRequests::DeleteSourceBranchWorker do
context 'with a non-existing user' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
+ expect(::MergeRequests::RetargetChainService).not_to receive(:new)
worker.perform(merge_request.id, sha, non_existing_record_id)
end
@@ -35,9 +37,18 @@ RSpec.describe MergeRequests::DeleteSourceBranchWorker do
worker.perform(merge_request.id, sha, user.id)
end
+ it 'calls service to try retarget merge requests' do
+ expect_next_instance_of(::MergeRequests::RetargetChainService) do |instance|
+ expect(instance).to receive(:execute).with(merge_request)
+ end
+
+ worker.perform(merge_request.id, sha, user.id)
+ end
+
context 'source branch sha does not match' do
it 'does nothing' do
expect(::Branches::DeleteService).not_to receive(:new)
+ expect(::MergeRequests::RetargetChainService).not_to receive(:new)
worker.perform(merge_request.id, 'new-source-branch-sha', user.id)
end