Return last builds on each branch for /builds?branches=true
This is a hack to fix travis-ci/travis-web#123 easier. A proper solution would be to refactor how /branches work.
This commit is contained in:
parent
46eefaf26d
commit
f2d768080f
|
@ -4,7 +4,8 @@ class Travis::Api::App
|
|||
class Endpoint
|
||||
class Builds < Endpoint
|
||||
get '/' do
|
||||
respond_with service(:find_builds, params)
|
||||
name = params[:branches] ? :find_branches : :find_builds
|
||||
respond_with service(name, params)
|
||||
end
|
||||
|
||||
get '/:id' do
|
||||
|
|
|
@ -29,4 +29,9 @@ describe 'Builds' do
|
|||
response = get "/repos/svenfuchs/minimal/builds/#{build.id}", {}, headers
|
||||
response.should deliver_json_for(build, version: 'v2')
|
||||
end
|
||||
|
||||
it 'GET /builds/1?repository_id=1&branches=true' do
|
||||
response = get "/builds?repository_id=#{repo.id}&branches=true", {}, headers
|
||||
response.should deliver_json_for(repo.last_finished_builds_by_branches, version: 'v2')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user