Commit 40e8185b authored by Z.J. van de Weg's avatar Z.J. van de Weg

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.
parent da0dd7ec
---
title: 'API: expose pipeline coverage'
merge_request:
author:
...@@ -606,6 +606,7 @@ module API ...@@ -606,6 +606,7 @@ module API
expose :user, with: Entities::UserBasic expose :user, with: Entities::UserBasic
expose :created_at, :updated_at, :started_at, :finished_at, :committed_at expose :created_at, :updated_at, :started_at, :finished_at, :committed_at
expose :duration expose :duration
expose :coverage
end end
class EnvironmentBasic < Grape::Entity class EnvironmentBasic < Grape::Entity
......
...@@ -103,6 +103,18 @@ describe API::API, api: true do ...@@ -103,6 +103,18 @@ describe API::API, api: true do
expect(json_response['message']).to eq '404 Not found' expect(json_response['message']).to eq '404 Not found'
expect(json_response['id']).to be nil expect(json_response['id']).to be nil
end 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 end
context 'unauthorized user' do context 'unauthorized user' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment