diff --git a/.travis.yml b/.travis.yml index 60413522..7341d32b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,3 +19,4 @@ notifications: irc: "irc.freenode.org#travis" services: - redis +cache: bundler 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