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:
parent
da0dd7ec96
commit
40e8185b64
3 changed files with 17 additions and 0 deletions
4
changelogs/unreleased/zj-expose-coverage-pipelines.yml
Normal file
4
changelogs/unreleased/zj-expose-coverage-pipelines.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: 'API: expose pipeline coverage'
|
||||
merge_request:
|
||||
author:
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue