diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-14 00:07:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-14 00:07:39 +0300 |
commit | 74a89b1221eaf780374bd1d4c5b2ee4a0f488908 (patch) | |
tree | 27dbcfdbc4216e9bee04b9be9c974d86744d51ba /spec/finders/merge_requests_finder_spec.rb | |
parent | b0abae12affecc466aeb10889e8a6c000d6f67f5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders/merge_requests_finder_spec.rb')
-rw-r--r-- | spec/finders/merge_requests_finder_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/finders/merge_requests_finder_spec.rb b/spec/finders/merge_requests_finder_spec.rb index bc85a622119..849387b72bd 100644 --- a/spec/finders/merge_requests_finder_spec.rb +++ b/spec/finders/merge_requests_finder_spec.rb @@ -166,6 +166,38 @@ describe MergeRequestsFinder do expect(scalar_params).to include(:wip, :assignee_id) end + + context 'filter by deployment' do + let_it_be(:project_with_repo) { create(:project, :repository) } + + it 'returns the relevant merge requests' do + deployment1 = create( + :deployment, + project: project_with_repo, + sha: project_with_repo.commit.id, + merge_requests: [merge_request1, merge_request2] + ) + create( + :deployment, + project: project_with_repo, + sha: project_with_repo.commit.id, + merge_requests: [merge_request3] + ) + params = { deployment_id: deployment1.id } + merge_requests = described_class.new(user, params).execute + + expect(merge_requests).to contain_exactly(merge_request1, merge_request2) + end + + context 'when a deployment does not contain any merge requests' do + it 'returns an empty result' do + params = { deployment_id: create(:deployment, project: project_with_repo, sha: project_with_repo.commit.sha).id } + merge_requests = described_class.new(user, params).execute + + expect(merge_requests).to be_empty + end + end + end end context 'assignee filtering' do |