diff --git a/lib/travis/api/v3/service_index.rb b/lib/travis/api/v3/service_index.rb index 39114408..2fb29200 100644 --- a/lib/travis/api/v3/service_index.rb +++ b/lib/travis/api/v3/service_index.rb @@ -37,7 +37,7 @@ module Travis::API::V3 end end end - { :@type => :home, :resources => resources } + { :@type => :home, :@href => "#{prefix}/", :resources => resources } end def render_json_home diff --git a/spec/v3/service_index_spec.rb b/spec/v3/service_index_spec.rb index b350c6d1..24949690 100644 --- a/spec/v3/service_index_spec.rb +++ b/spec/v3/service_index_spec.rb @@ -98,17 +98,20 @@ describe Travis::API::V3::ServiceIndex do describe 'with /v3 prefix' do let(:path) { '/v3/' } - specify(:resources) { expect(json['resources']).to be == expected_resources } + specify(:resources) { expect(json['resources']) .to be == expected_resources } + specify(:@href) { expect(json['@href']) .to be == '/v3/' } end describe 'with Accept header' do let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.3+json' } } - specify(:resources) { expect(json['resources']).to be == expected_resources } + specify(:resources) { expect(json['resources']) .to be == expected_resources } + specify(:@href) { expect(json['@href']) .to be == '/' } end describe 'with Travis-API-Version header' do let(:headers) { { 'HTTP_TRAVIS_API_VERSION' => '3' } } - specify(:resources) { expect(json['resources']).to be == expected_resources } + specify(:resources) { expect(json['resources']) .to be == expected_resources } + specify(:@href) { expect(json['@href']) .to be == '/' } end end