From ba01e519e24bf716c138a0b46e371c60de4aa935 Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" Date: Thu, 18 Aug 2016 11:42:37 +0200 Subject: Incorporate feedback --- doc/api/deployments.md | 4 ++-- lib/api/builds.rb | 14 ++++++-------- spec/requests/api/builds_spec.rb | 1 + 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/api/deployments.md b/doc/api/deployments.md index 9ce95664435..9a0d09d2623 100644 --- a/doc/api/deployments.md +++ b/doc/api/deployments.md @@ -260,10 +260,10 @@ GET /projects/:id/deployments/:deployment_id | Attribute | Type | Required | Description | |-----------|---------|----------|---------------------| | `id` | integer | yes | The ID of a project | -| `deployment_id` | string | yes | The ID of the deployment | +| `deployment_id` | integer | yes | The ID of the deployment | ```bash -curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/deployment/1" +curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/deployments/1" ``` Example of response diff --git a/lib/api/builds.rb b/lib/api/builds.rb index 2bd3b65acdc..52bdbcae5a8 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -202,15 +202,13 @@ module API build = get_build!(params[:build_id]) - if build.playable? - build.play(current_user) + bad_request!("Unplayable Build") unless build.playable? - status 200 - present build, with: Entities::Build, - user_can_download_artifacts: can?(current_user, :read_build, user_project) - else - bad_request!("Unplayable Build") - end + build.play(current_user) + + status 200 + present build, with: Entities::Build, + user_can_download_artifacts: can?(current_user, :read_build, user_project) end end diff --git a/spec/requests/api/builds_spec.rb b/spec/requests/api/builds_spec.rb index 02b7e0c819f..9a17a705b1e 100644 --- a/spec/requests/api/builds_spec.rb +++ b/spec/requests/api/builds_spec.rb @@ -419,6 +419,7 @@ describe API::API, api: true do it 'plays the build' do expect(response).to have_http_status 200 expect(json_response['user']['id']).to eq(user.id) + expect(json_response['id']).to eq(build.id) end end -- cgit v1.2.1