Add /requests/:id endpoint
This commit is contained in:
parent
23dd318412
commit
400b6ae6ee
|
@ -17,6 +17,10 @@ class Travis::Api::App
|
||||||
{ "error" => "Repository could not be found" }
|
{ "error" => "Repository could not be found" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get '/:id' do
|
||||||
|
respond_with service(:find_request, params)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,7 @@ require 'spec_helper'
|
||||||
describe 'Requests' do
|
describe 'Requests' do
|
||||||
let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.2+json' } }
|
let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.2+json' } }
|
||||||
|
|
||||||
|
describe '/requests' do
|
||||||
it 'fetches requests' do
|
it 'fetches requests' do
|
||||||
repo = Factory.create(:repository)
|
repo = Factory.create(:repository)
|
||||||
request = Factory.create(:request, repository: repo)
|
request = Factory.create(:request, repository: repo)
|
||||||
|
@ -16,3 +17,14 @@ describe 'Requests' do
|
||||||
JSON.parse(response.body)['error'].should == "Repository could not be found"
|
JSON.parse(response.body)['error'].should == "Repository could not be found"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '/requests/:id' do
|
||||||
|
it 'fetches a request' do
|
||||||
|
repo = Factory.create(:repository)
|
||||||
|
request = Factory.create(:request, repository: repo)
|
||||||
|
|
||||||
|
response = get "/requests/#{request.id}", {}, headers
|
||||||
|
response.should deliver_json_for(request, version: 'v2', type: 'request')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user