diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /spec/services/git | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) | |
download | gitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/services/git')
-rw-r--r-- | spec/services/git/process_ref_changes_service_spec.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/services/git/process_ref_changes_service_spec.rb b/spec/services/git/process_ref_changes_service_spec.rb index fc5e379f51d..924e913a9ec 100644 --- a/spec/services/git/process_ref_changes_service_spec.rb +++ b/spec/services/git/process_ref_changes_service_spec.rb @@ -160,6 +160,49 @@ describe Git::ProcessRefChangesService do let(:ref_prefix) { 'refs/heads' } it_behaves_like 'service for processing ref changes', Git::BranchPushService + + context 'when there are merge requests associated with branches' do + let(:tag_changes) do + [ + { index: 0, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789012', ref: "refs/tags/v10.0.0" } + ] + end + let(:branch_changes) 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" } + ] + 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 + + 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 + + subject.execute + end + + context 'refresh_only_existing_merge_requests_on_push disabled' do + before do + stub_feature_flags(refresh_only_existing_merge_requests_on_push: false) + end + + it 'refreshes all merge requests' do + expect(UpdateMergeRequestsWorker).to receive(:perform_async).exactly(3).times + + subject.execute + end + end + end end context 'tag changes' do |