From 143a9cd07157d02554c0bd0a317570cabfbef257 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 17 Jun 2014 14:44:13 +0200 Subject: [PATCH 1/2] Revert "removed the branches endpoint" This reverts commit f7450cdb6b195e5220b6568f2fbf07db88171dd0. --- lib/travis/api/app/endpoint/branches.rb | 16 ++++++++++++++++ spec/integration/v1/branches_spec.rb | 11 +++++++++++ spec/integration/v2/branches_spec.rb | 11 +++++++++++ spec/unit/endpoint/branches_spec.rb | 5 +++++ 4 files changed, 43 insertions(+) create mode 100644 lib/travis/api/app/endpoint/branches.rb create mode 100644 spec/integration/v1/branches_spec.rb create mode 100644 spec/integration/v2/branches_spec.rb create mode 100644 spec/unit/endpoint/branches_spec.rb diff --git a/lib/travis/api/app/endpoint/branches.rb b/lib/travis/api/app/endpoint/branches.rb new file mode 100644 index 00000000..5f071bd6 --- /dev/null +++ b/lib/travis/api/app/endpoint/branches.rb @@ -0,0 +1,16 @@ +require 'travis/api/app' + +class Travis::Api::App + class Endpoint + class Branches < Endpoint + get '/' do + respond_with service(:find_branches, params), type: :branches + end + + # get '/:owner_name/:name/branches' do # v1 + # get '/repos/:owner_name/:name/branches' do # v2 + # respond_with service(:branches, :find_all, params), type: :branches + # end + end + end +end diff --git a/spec/integration/v1/branches_spec.rb b/spec/integration/v1/branches_spec.rb new file mode 100644 index 00000000..6e5c8735 --- /dev/null +++ b/spec/integration/v1/branches_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe 'Branches' do + let(:repo) { Repository.by_slug('svenfuchs/minimal').first } + let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.1+json' } } + + it 'GET /branches?repository_id=:repository_id' do + response = get '/branches', { repository_id: repo.id }, headers + response.should deliver_json_for(repo.last_finished_builds_by_branches, version: 'v1', type: 'branches') + end +end diff --git a/spec/integration/v2/branches_spec.rb b/spec/integration/v2/branches_spec.rb new file mode 100644 index 00000000..3e54ecc8 --- /dev/null +++ b/spec/integration/v2/branches_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe 'Branches' do + let(:repo) { Repository.by_slug('svenfuchs/minimal').first } + let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.2+json' } } + + it 'GET /branches?repository_id=:repository_id' do + response = get '/branches', { repository_id: repo.id }, headers + response.should deliver_json_for(repo.last_finished_builds_by_branches, version: 'v2', type: 'branches') + end +end diff --git a/spec/unit/endpoint/branches_spec.rb b/spec/unit/endpoint/branches_spec.rb new file mode 100644 index 00000000..03923cfd --- /dev/null +++ b/spec/unit/endpoint/branches_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Travis::Api::App::Endpoint::Branches do + it 'has to be tested' +end From 897be0f20046c47378fc5612cbda39e0cb40fe7e Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 17 Jun 2014 14:56:13 +0200 Subject: [PATCH 2/2] enable bundler caching --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 157e917a..fcf7f07d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,3 +13,4 @@ notifications: irc: "irc.freenode.org#travis" services: - redis +cache: bundler