diff options
author | Sean McGivern <sean@gitlab.com> | 2019-02-19 15:05:26 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-02-19 15:05:26 +0300 |
commit | cccf61150900778899d5e8763a0209fe22d87532 (patch) | |
tree | 4514161f19768c0f7f6a45fcba65ad8c7241e89c /spec | |
parent | 08e2104e0445877a056468d4675aa72af5ebb2ae (diff) | |
parent | 3dca5b307683e9f91941d6ddafaace6d856f8c7b (diff) |
Merge branch '55376-related_merge_requests-api-call-returns-merge-requests-that-are-not-related-to-the-issue' into 'master'
Ensure that related_merge_requests api call returns merge requests in the correct scope
Closes #55376
See merge request gitlab-org/gitlab-ce!25222
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/issues_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index b5cc13eff29..d10ee6cc320 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -1894,7 +1894,7 @@ describe API::Issues do description: "See #{issue.to_reference}" } create(:merge_request, attributes).tap do |merge_request| - create(:note, :system, project: project, noteable: issue, author: user, note: merge_request.to_reference(full: true)) + create(:note, :system, project: issue.project, noteable: issue, author: user, note: merge_request.to_reference(full: true)) end end @@ -1931,6 +1931,24 @@ describe API::Issues do expect_paginated_array_response(related_mr.id) end + it 'returns merge requests cross-project wide' do + project2 = create(:project, :public, creator_id: user.id, namespace: user.namespace) + merge_request = create_referencing_mr(user, project2, issue) + + get_related_merge_requests(project.id, issue.iid, user) + + expect_paginated_array_response([related_mr.id, merge_request.id]) + end + + it 'does not generate references to projects with no access' do + private_project = create(:project, :private) + create_referencing_mr(private_project.creator, private_project, issue) + + get_related_merge_requests(project.id, issue.iid, user) + + expect_paginated_array_response(related_mr.id) + end + context 'no merge request mentioned a issue' do it 'returns empty array' do get_related_merge_requests(project.id, closed_issue.iid, user) |