cleanup and some notes
This commit is contained in:
parent
ac8dd768ec
commit
6bda358786
|
@ -6,6 +6,11 @@ class Travis::Api::App
|
||||||
get '/' do
|
get '/' do
|
||||||
respond_with all(params).run, type: :branches
|
respond_with all(params).run, type: :branches
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# get '/:owner_name/:name/branches' do # v1
|
||||||
|
# get '/repos/:owner_name/:name/branches' do # v2
|
||||||
|
# respond_with all(params).run, type: :branches
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,11 @@ class Travis::Api::App
|
||||||
respond_with all(params).run
|
respond_with all(params).run
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# get '/:owner_name/:name/builds' do # v1
|
||||||
|
# get '/repos/:owner_name/:name/builds' do # v2
|
||||||
|
# respond_with all(params).run
|
||||||
|
# end
|
||||||
|
|
||||||
get '/:id' do
|
get '/:id' do
|
||||||
respond_with one(params).run
|
respond_with one(params).run
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,13 +12,13 @@ class Travis::Api::App
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO the format constraint neither seems to work nor fail?
|
# TODO the format constraint neither seems to work nor fail?
|
||||||
get '/:id/cc.:format', format: 'xml' do
|
get '/:id/cc.:format', format: 'xml' do # v1
|
||||||
respond_with one(params).run
|
respond_with one(params).run
|
||||||
end
|
end
|
||||||
|
|
||||||
# get '/:owner_name/:name.:format', format: 'png' do
|
# get '/:owner_name/:name.?:format?' do # v1
|
||||||
# pass unless params.key?('owner_name') && params.key?('name')
|
# get '/repos/:owner_name/:name.?:format?' do # v2
|
||||||
# result_image service(:repositories, :one, params).run(:raise => false)
|
# respond_with service(:repositories, :one, params).run(:raise => params[:format] != 'png')
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,7 @@ require 'travis/api/app'
|
||||||
|
|
||||||
class Travis::Api::App
|
class Travis::Api::App
|
||||||
class Endpoint
|
class Endpoint
|
||||||
|
# TODO should this be /profile?
|
||||||
class Users < Endpoint
|
class Users < Endpoint
|
||||||
# Gives information about the currently logged in user.
|
# Gives information about the currently logged in user.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
# require 'spec_helper'
|
|
||||||
#
|
|
||||||
# describe 'Result images' do
|
|
||||||
# let!(:repo) { Factory(:repository, owner_name: 'svenfuchs', name: 'minimal') }
|
|
||||||
#
|
|
||||||
# describe 'GET /svenfuchs/minimal.png' do
|
|
||||||
# it '"unknown" when the repository does not exist' do
|
|
||||||
# get('/svenfuchs/does-not-exist.png').should deliver_result_image_for('unknown')
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# it '"unknown" when it only has one build that is not finished' do
|
|
||||||
# repo.update_attributes!(last_build_result: nil)
|
|
||||||
# get('/svenfuchs/minimal.png').should deliver_result_image_for('unknown')
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# it '"failing" when the last build has failed' do
|
|
||||||
# repo.update_attributes!(last_build_result: 1)
|
|
||||||
# get('/svenfuchs/minimal.png').should deliver_result_image_for('failing')
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# it '"passing" when the last build has passed' do
|
|
||||||
# repo.update_attributes!(last_build_result: 0)
|
|
||||||
# get('/svenfuchs/minimal.png').should deliver_result_image_for('passing')
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# it '"passing" when there is a running build but the previous one has passed' do
|
|
||||||
# Factory(:build, repository: repo, state: :finished, result: nil, previous_result: 0)
|
|
||||||
# repo.update_attributes!(last_build_result: nil)
|
|
||||||
# get('/svenfuchs/minimal.png').should deliver_result_image_for('passing')
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# describe 'GET /svenfuchs/minimal.png' do
|
|
||||||
# let(:commit) { Factory(:commit, branch: 'dev') }
|
|
||||||
#
|
|
||||||
# it '"unknown" when the repository does not exist' do
|
|
||||||
# get('/svenfuchs/does-not-exist.png?branch=dev').should deliver_result_image_for('unknown')
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# it '"unknown" when it only has a build that is not finished' do
|
|
||||||
# Factory(:build, repository: repo, state: :started, result: nil, commit: commit)
|
|
||||||
# get('/svenfuchs/minimal.png?branch=dev').should deliver_result_image_for('unknown')
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# it '"failing" when the last build has failed' do
|
|
||||||
# Factory(:build, repository: repo, state: :finished, result: 1, commit: commit)
|
|
||||||
# get('/svenfuchs/minimal.png?branch=dev').should deliver_result_image_for('failing')
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# it '"passing" when the last build has passed' do
|
|
||||||
# Factory(:build, repository: repo, state: :finished, result: 0, commit: commit)
|
|
||||||
# get('/svenfuchs/minimal.png?branch=dev').should deliver_result_image_for('passing')
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# it '"passing" when there is a running build but the previous one has passed' do
|
|
||||||
# Factory(:build, repository: repo, state: :finished, result: 0, commit: commit)
|
|
||||||
# Factory(:build, repository: repo, state: :started, result: nil, commit: commit)
|
|
||||||
# repo.update_attributes!(last_build_result: nil)
|
|
||||||
# get('/svenfuchs/minimal.png?branch=dev').should deliver_result_image_for('passing')
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
|
@ -46,55 +46,55 @@ describe 'Repos' do
|
||||||
get('/svenfuchs/does-not-exist.png').should deliver_result_image_for('unknown')
|
get('/svenfuchs/does-not-exist.png').should deliver_result_image_for('unknown')
|
||||||
end
|
end
|
||||||
|
|
||||||
xit '"unknown" when it only has a build that is not finished' do
|
xit '"unknown" when it only has one build that is not finished' do
|
||||||
repo.builds.delete_all
|
repo.update_attributes!(last_build_result: nil)
|
||||||
Factory(:running_build, repository: repo)
|
|
||||||
get('/svenfuchs/minimal.png').should deliver_result_image_for('unknown')
|
get('/svenfuchs/minimal.png').should deliver_result_image_for('unknown')
|
||||||
end
|
end
|
||||||
|
|
||||||
xit '"failing" when the last build has failed' do
|
xit '"failing" when the last build has failed' do
|
||||||
repo.last_build.update_attributes!(:result => 1)
|
repo.update_attributes!(last_build_result: 1)
|
||||||
get('/svenfuchs/minimal.png').should deliver_result_image_for('failing')
|
get('/svenfuchs/minimal.png').should deliver_result_image_for('failing')
|
||||||
end
|
end
|
||||||
|
|
||||||
xit '"passing" when the last build has passed' do
|
xit '"passing" when the last build has passed' do
|
||||||
repo.last_build.update_attributes!(:result => 0)
|
repo.update_attributes!(last_build_result: 0)
|
||||||
get('/svenfuchs/minimal.png').should deliver_result_image_for('failing')
|
|
||||||
end
|
|
||||||
|
|
||||||
# TODO what? there's not even an image for this
|
|
||||||
xit '"stable" when there is a running build but the previous one has passed' do
|
|
||||||
Factory(:running_build, repository: repo)
|
|
||||||
repo.last_build.update_attributes!(:result => 0)
|
|
||||||
get('/svenfuchs/minimal.png').should deliver_result_image_for('stable')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'GET /svenfuchs/minimal.png' do
|
|
||||||
xit '"unknown" when the repository does not exist' do
|
|
||||||
get('/svenfuchs/minimal.png').should deliver_result_image_for('unknown')
|
|
||||||
end
|
|
||||||
|
|
||||||
xit '"unknown" when it only has a build that is not finished' do
|
|
||||||
repo.builds.delete_all
|
|
||||||
Factory(:running_build, repository: repo)
|
|
||||||
get('/svenfuchs/minimal.png').should deliver_result_image_for('unknown')
|
|
||||||
end
|
|
||||||
|
|
||||||
xit '"failing" when the last build has failed' do
|
|
||||||
repo.last_build.update_attributes!(:result => 1)
|
|
||||||
get('/svenfuchs/minimal.png').should deliver_result_image_for('failing')
|
|
||||||
end
|
|
||||||
|
|
||||||
xit '"passing" when the last build has passed' do
|
|
||||||
repo.last_build.update_attributes!(:result => 0)
|
|
||||||
get('/svenfuchs/minimal.png').should deliver_result_image_for('passing')
|
get('/svenfuchs/minimal.png').should deliver_result_image_for('passing')
|
||||||
end
|
end
|
||||||
|
|
||||||
xit '"passing" when there is a running build but the previous one has passed' do
|
xit '"passing" when there is a running build but the previous one has passed' do
|
||||||
repo.last_build.update_attributes!(:result => 0)
|
Factory(:build, repository: repo, state: :finished, result: nil, previous_result: 0)
|
||||||
Factory(:running_build, :repository => repo)
|
repo.update_attributes!(last_build_result: nil)
|
||||||
get_png(repository, :branch => 'master').should serve_result_image('passing')
|
get('/svenfuchs/minimal.png').should deliver_result_image_for('passing')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET /svenfuchs/minimal.png' do
|
||||||
|
let(:commit) { Factory(:commit, branch: 'dev') }
|
||||||
|
|
||||||
|
xit '"unknown" when the repository does not exist' do
|
||||||
|
get('/svenfuchs/does-not-exist.png?branch=dev').should deliver_result_image_for('unknown')
|
||||||
|
end
|
||||||
|
|
||||||
|
xit '"unknown" when it only has a build that is not finished' do
|
||||||
|
Factory(:build, repository: repo, state: :started, result: nil, commit: commit)
|
||||||
|
get('/svenfuchs/minimal.png?branch=dev').should deliver_result_image_for('unknown')
|
||||||
|
end
|
||||||
|
|
||||||
|
xit '"failing" when the last build has failed' do
|
||||||
|
Factory(:build, repository: repo, state: :finished, result: 1, commit: commit)
|
||||||
|
get('/svenfuchs/minimal.png?branch=dev').should deliver_result_image_for('failing')
|
||||||
|
end
|
||||||
|
|
||||||
|
xit '"passing" when the last build has passed' do
|
||||||
|
Factory(:build, repository: repo, state: :finished, result: 0, commit: commit)
|
||||||
|
get('/svenfuchs/minimal.png?branch=dev').should deliver_result_image_for('passing')
|
||||||
|
end
|
||||||
|
|
||||||
|
xit '"passing" when there is a running build but the previous one has passed' do
|
||||||
|
Factory(:build, repository: repo, state: :finished, result: 0, commit: commit)
|
||||||
|
Factory(:build, repository: repo, state: :started, result: nil, commit: commit)
|
||||||
|
repo.update_attributes!(last_build_result: nil)
|
||||||
|
get('/svenfuchs/minimal.png?branch=dev').should deliver_result_image_for('passing')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user