diff options
author | Tony Rom <thetonyrom@gmail.com> | 2018-01-10 20:05:34 +0300 |
---|---|---|
committer | Tony Rom <thetonyrom@gmail.com> | 2018-01-10 20:05:34 +0300 |
commit | 7ed08fcd5db058500b3092fd94791e9bd8a29bb7 (patch) | |
tree | 2dd5d99eddef5715b634d9a630c7f354b5b3af87 | |
parent | fd88b0ca56b3a4230902f76a7b049228e53e6bb0 (diff) |
Fix style
-rw-r--r-- | doc/api/merge_requests.md | 2 | ||||
-rw-r--r-- | lib/api/merge_requests.rb | 5 | ||||
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 6 |
3 files changed, 9 insertions, 4 deletions
diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index a3261cf7ee4..f9cbdffc254 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -444,8 +444,6 @@ Parameters: - `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user - `merge_request_iid` (required) - The internal ID of the merge request -Example of response - ```json [ { diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 77c563ec0b4..6ccdacd1067 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -24,8 +24,9 @@ module API .preload(:notes, :author, :assignee, :milestone, :latest_merge_request_diff, :labels, :timelogs) end - def merge_request_pipelines_with_access(access_level = :read_pipeline) - authorize! access_level, user_project + def merge_request_pipelines_with_access + authorize! :read_pipeline, user_project + mr = find_merge_request_with_access(params[:merge_request_iid]) mr.all_pipelines end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 4278e32dc78..aeee2fbc092 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -546,6 +546,12 @@ describe API::MergeRequests do expect(response).to have_gitlab_http_status(200) expect(response).to match_response_schema('public_api/v4/pipelines') end + + it 'returns 404 if MR does not exist' do + get api("/projects/#{project.id}/merge_requests/777/pipelines") + + expect(response).to have_gitlab_http_status(404) + end end context 'when unauthorized' do |