summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-08-18 11:42:37 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-08-18 11:42:52 +0200
commit217204ec943828843f25fb9ca4a77ca2e30495ef (patch)
tree3d9ae97cc32a9cd46bbcb52898e50b18847718bf
parent731781a4b379ef55a737d6cfddeaa9a098608f9f (diff)
downloadgitlab-ce-zj-api-endpoints-ci.tar.gz
Incorporate feedbackzj-api-endpoints-ci
-rw-r--r--doc/api/deployments.md4
-rw-r--r--lib/api/builds.rb14
-rw-r--r--spec/requests/api/builds_spec.rb1
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