From 65a90fd5d7d8e3f0daaf1a0ac948192d79880e54 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 11 Sep 2014 14:35:19 +0200 Subject: [PATCH] Fix specyfing part_numbers in API Recently I've implmented a way to get only specific parts from log API, but the test and implementation were wrong. This commit fixes that. --- lib/travis/api/v2/http/log.rb | 2 +- spec/integration/v2/jobs_spec.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/travis/api/v2/http/log.rb b/lib/travis/api/v2/http/log.rb index b3024cde..849ffea6 100644 --- a/lib/travis/api/v2/http/log.rb +++ b/lib/travis/api/v2/http/log.rb @@ -50,7 +50,7 @@ module Travis end def part_numbers - if numbers = options[:part_numbers] + if numbers = options['part_numbers'] numbers.is_a?(String) ? numbers.split(',').map(&:to_i) : numbers end end diff --git a/spec/integration/v2/jobs_spec.rb b/spec/integration/v2/jobs_spec.rb index a8a63b7d..5a40d28b 100644 --- a/spec/integration/v2/jobs_spec.rb +++ b/spec/integration/v2/jobs_spec.rb @@ -58,7 +58,9 @@ describe 'Jobs' do headers = { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.2+json; chunked=true' } response = get "/jobs/#{job.id}/log", { part_numbers: '1,3,4' }, headers - response.should deliver_json_for(job.log, version: 'v2', params: { chunked: true}) + body = JSON.parse(response.body) + + body['log']['parts'].map { |p| p['number'] }.sort.should == [1, 3] end it 'responds with 406 when log is already aggregated' do