From e31bf1fe7f7847dab0a527eb73a044c48f20b42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Wed, 24 Aug 2016 13:20:24 +0200 Subject: [PATCH] Added tests for querrying multiple jobs --- spec/integration/v2/jobs_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spec/integration/v2/jobs_spec.rb b/spec/integration/v2/jobs_spec.rb index 1f5eecd6..c83167a0 100644 --- a/spec/integration/v2/jobs_spec.rb +++ b/spec/integration/v2/jobs_spec.rb @@ -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(jobs.first(1), 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(jobs.order('id ASC'), 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')