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 21:10:53 +0200
commitba01e519e24bf716c138a0b46e371c60de4aa935 (patch)
tree1021901a6a273f940e480914562ae59e4f35a31d
parent182e28141d2e1ac904590a431ed7249d4c20984b (diff)
downloadgitlab-ce-ba01e519e24bf716c138a0b46e371c60de4aa935.tar.gz
Incorporate feedback
-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