Rebase to master for avoiding failing tests

This commit is contained in:
George Andrinopoulos 2017-02-14 17:51:30 +02:00 committed by Rémy Coutable
parent f106ad5135
commit df97e21c4f
3 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,4 @@
---
title: Add all available statuses to scope filter for project builds endpoint
merge_request:
author: George Andrinopoulos

View File

@ -11,7 +11,7 @@ module API
helpers do
params :optional_scope do
optional :scope, types: [String, Array[String]], desc: 'The scope of builds to show',
values: ['pending', 'running', 'failed', 'success', 'canceled'],
values: ::CommitStatus::AVAILABLE_STATUSES,
coerce_with: ->(scope) {
if scope.is_a?(String)
[scope]

View File

@ -16,6 +16,8 @@ describe API::Builds, api: true do
let(:query) { '' }
before do
create(:ci_build, :skipped, pipeline: pipeline)
get api("/projects/#{project.id}/builds?#{query}", api_user)
end
@ -49,6 +51,18 @@ describe API::Builds, api: true do
end
end
context 'filter project with scope skipped' do
let(:query) { 'scope=skipped' }
let(:json_build) { json_response.first }
it 'return builds with status skipped' do
expect(response).to have_http_status 200
expect(json_response).to be_an Array
expect(json_response.length).to eq 1
expect(json_build['status']).to eq 'skipped'
end
end
context 'filter project with array of scope elements' do
let(:query) { 'scope[0]=pending&scope[1]=running' }