diff options
author | Matija Čupić <matteeyah@gmail.com> | 2019-06-08 18:13:31 +0200 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2019-06-08 18:13:31 +0200 |
commit | 5f0687d07a65900654245fd3f68902691316c892 (patch) | |
tree | 55daaed5f6d2e36db0c5c6cb91302d9fd001efcf /spec/requests/api/merge_requests_spec.rb | |
parent | 2a01cb79560a861a7e32e9ee11e823f22e181aa1 (diff) | |
download | gitlab-ce-5f0687d07a65900654245fd3f68902691316c892.tar.gz |
Gate MR head_pipeline behind read_pipeline ability
Diffstat (limited to 'spec/requests/api/merge_requests_spec.rb')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 4cb4fcc890d..c54861a6b63 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -834,6 +834,31 @@ describe API::MergeRequests do end end + context 'head_pipeline' do + before do + merge_request.update(head_pipeline: create(:ci_pipeline)) + merge_request.project.project_feature.update(builds_access_level: 10) + end + + context 'when user can read the pipeline' do + it 'exposes pipeline information' do + get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}", user) + + expect(json_response).to include('head_pipeline') + end + end + + context 'when user can not read the pipeline' do + let(:guest) { create(:user) } + + it 'does not expose pipeline information' do + get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}", guest) + + expect(json_response).not_to include('head_pipeline') + end + end + end + it 'returns the commits behind the target branch when include_diverged_commits_count is present' do allow_any_instance_of(merge_request.class).to receive(:diverged_commits_count).and_return(1) |