Compare commits

..

7 Commits

Author SHA1 Message Date
Georges Dupéron
019189720b Another attempt at serialization 2016-08-24 16:38:52 +02:00
Georges Dupéron
5e80535de7 Another attempt at serialization 2016-08-24 16:31:30 +02:00
Georges Dupéron
af19859e29 Another attempt at serialization 2016-08-24 16:08:46 +02:00
Georges Dupéron
b6699af277 Attempt to serialize array 2016-08-24 16:02:21 +02:00
Georges Dupéron
62b1857392 Fixed tests 2016-08-24 14:02:04 +02:00
Georges Dupéron
e31bf1fe7f Added tests for querrying multiple jobs 2016-08-24 13:20:24 +02:00
Georges Dupéron
cf188bd3a0 Fixes https://github.com/travis-ci/travis-ci/issues/5457 2016-08-23 16:05:23 +02:00
2 changed files with 13 additions and 1 deletions

View File

@ -11,6 +11,7 @@ class Travis::Api::App
get '/' do
prefer_follower do
params['ids'] = params['ids'].split(',') if params['ids'].respond_to?(:split)
respond_with service(:find_jobs, params)
end
end

View File

@ -11,11 +11,22 @@ describe 'Jobs', set_app: true do
response.should deliver_json_for(Job.queued('builds.common'), version: 'v2')
end
it '/jobs/:id' do
it 'GET /jobs/:id' do
response = get "/jobs/#{job.id}", {}, headers
response.should deliver_json_for(job, version: 'v2')
end
it 'GET /jobs?ids=1' do
response = get "/jobs?ids=#{job.id}", {}, headers
response.should deliver_json_for(Travis::Api::App::Jobs.new([job]), version: 'v2')
end
it 'GET /jobs?ids=1,2' do
ids = jobs.map(&:id).sort.join(',')
response = get "/jobs?ids=#{ids}", {}, headers
response.should deliver_json_for(Travis::Api::App::Jobs.new(jobs.sort { |a,b| a.id <=> b.id }), version: 'v2')
end
context 'GET /jobs/:job_id/log.txt' do
it 'returns log for a job' do
job.log.update_attributes!(content: 'the log')