v3: add @href to home document

This commit is contained in:
Konstantin Haase 2015-03-10 11:29:03 +01:00
parent 3c43f7e3fd
commit 0f6b02b339
2 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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