diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/finders/merge_requests | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/finders/merge_requests')
-rw-r--r-- | spec/finders/merge_requests/oldest_per_commit_finder_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/finders/merge_requests/oldest_per_commit_finder_spec.rb b/spec/finders/merge_requests/oldest_per_commit_finder_spec.rb index 4724a8eb5c7..6dffaff294d 100644 --- a/spec/finders/merge_requests/oldest_per_commit_finder_spec.rb +++ b/spec/finders/merge_requests/oldest_per_commit_finder_spec.rb @@ -77,6 +77,45 @@ RSpec.describe MergeRequests::OldestPerCommitFinder do expect(described_class.new(project).execute(commits)).to eq(sha => mr) end + it 'includes a merge request that was squashed into the target branch' do + project = create(:project) + sha = Digest::SHA1.hexdigest('foo') + mr = create( + :merge_request, + :merged, + target_project: project, + squash_commit_sha: sha + ) + + commits = [double(:commit, id: sha)] + + expect(MergeRequestDiffCommit) + .not_to receive(:oldest_merge_request_id_per_commit) + + expect(described_class.new(project).execute(commits)).to eq(sha => mr) + end + + it 'includes a merge request for both a squash and merge commit' do + project = create(:project) + sha1 = Digest::SHA1.hexdigest('foo') + sha2 = Digest::SHA1.hexdigest('bar') + mr = create( + :merge_request, + :merged, + target_project: project, + squash_commit_sha: sha1, + merge_commit_sha: sha2 + ) + + commits = [double(:commit1, id: sha1), double(:commit2, id: sha2)] + + expect(MergeRequestDiffCommit) + .not_to receive(:oldest_merge_request_id_per_commit) + + expect(described_class.new(project).execute(commits)) + .to eq(sha1 => mr, sha2 => mr) + end + it 'includes the oldest merge request when a merge commit is present in a newer merge request' do project = create(:project) sha = Digest::SHA1.hexdigest('foo') |