Expose coverage on GET pipelines/:id

The coverage wasn't exposed yet, now it is but only for detailed
requests to save queries on the database.
This commit is contained in:
Z.J. van de Weg 2016-11-22 17:28:58 +01:00
parent da0dd7ec96
commit 40e8185b64
3 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,4 @@
---
title: 'API: expose pipeline coverage'
merge_request:
author:

View file

@ -606,6 +606,7 @@ module API
expose :user, with: Entities::UserBasic
expose :created_at, :updated_at, :started_at, :finished_at, :committed_at
expose :duration
expose :coverage
end
class EnvironmentBasic < Grape::Entity

View file

@ -103,6 +103,18 @@ describe API::API, api: true do
expect(json_response['message']).to eq '404 Not found'
expect(json_response['id']).to be nil
end
context 'with coverage' do
before do
create(:ci_build, coverage: 30, pipeline: pipeline)
end
it 'exposes the coverage' do
get api("/projects/#{project.id}/pipelines/#{pipeline.id}", user)
expect(json_response["coverage"].to_i).to eq(30)
end
end
end
context 'unauthorized user' do