summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-04 03:16:09 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-04 03:16:09 +0000
commit242358bb7b8e031b9b975340750be33b19015cfa (patch)
tree55cf5342bc232ba517698a1f82e859d5fdf25fac /spec/services
parent517f254952ababb661160d3afd659902d18e29cd (diff)
downloadgitlab-ce-242358bb7b8e031b9b975340750be33b19015cfa.tar.gz
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/git/process_ref_changes_service_spec.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/spec/services/git/process_ref_changes_service_spec.rb b/spec/services/git/process_ref_changes_service_spec.rb
index fc313bf6eb9..087f4ba372b 100644
--- a/spec/services/git/process_ref_changes_service_spec.rb
+++ b/spec/services/git/process_ref_changes_service_spec.rb
@@ -172,23 +172,31 @@ RSpec.describe Git::ProcessRefChangesService do
[
{ index: 0, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789012', ref: "#{ref_prefix}/create1" },
{ index: 1, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789013', ref: "#{ref_prefix}/create2" },
- { index: 2, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789014', ref: "#{ref_prefix}/create3" }
+ { index: 2, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789014', ref: "#{ref_prefix}/create3" },
+ { index: 3, oldrev: '789015', newrev: '789016', ref: "#{ref_prefix}/changed1" },
+ { index: 4, oldrev: '789017', newrev: '789018', ref: "#{ref_prefix}/changed2" },
+ { index: 5, oldrev: '789019', newrev: Gitlab::Git::BLANK_SHA, ref: "#{ref_prefix}/removed1" },
+ { index: 6, oldrev: '789020', newrev: Gitlab::Git::BLANK_SHA, ref: "#{ref_prefix}/removed2" }
]
end
let(:git_changes) { double(branch_changes: branch_changes, tag_changes: tag_changes) }
- it 'schedules job for existing merge requests' do
- expect_next_instance_of(MergeRequests::PushedBranchesService) do |service|
- expect(service).to receive(:execute).and_return(%w(create1 create2))
- end
+ before do
+ allow(MergeRequests::PushedBranchesService).to receive(:new).and_return(
+ double(execute: %w(create1 create2)), double(execute: %w(changed1)), double(execute: %w(removed2))
+ )
+ end
+ it 'schedules job for existing merge requests' do
expect(UpdateMergeRequestsWorker).to receive(:perform_async)
.with(project.id, user.id, Gitlab::Git::BLANK_SHA, '789012', "#{ref_prefix}/create1").ordered
expect(UpdateMergeRequestsWorker).to receive(:perform_async)
.with(project.id, user.id, Gitlab::Git::BLANK_SHA, '789013', "#{ref_prefix}/create2").ordered
- expect(UpdateMergeRequestsWorker).not_to receive(:perform_async)
- .with(project.id, user.id, Gitlab::Git::BLANK_SHA, '789014', "#{ref_prefix}/create3").ordered
+ expect(UpdateMergeRequestsWorker).to receive(:perform_async)
+ .with(project.id, user.id, '789015', '789016', "#{ref_prefix}/changed1").ordered
+ expect(UpdateMergeRequestsWorker).to receive(:perform_async)
+ .with(project.id, user.id, '789020', Gitlab::Git::BLANK_SHA, "#{ref_prefix}/removed2").ordered
subject.execute
end