travis-api/spec/integration/v2/requests_spec.rb
Piotr Sarnacki 093831c1a2 Add requests API
Requests API allows to get the requests from the DB and thus enable
users to have more insight into what's going on in their repositories.
2014-03-06 19:36:55 +01:00

19 lines
623 B
Ruby

require 'spec_helper'
describe 'Requests' do
let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.2+json' } }
it 'fetches requests' do
repo = Factory.create(:repository)
request = Factory.create(:request, repository: repo)
response = get '/requests', { repository_id: repo.id }, headers
response.should deliver_json_for(repo.requests, version: 'v2', type: 'requests')
end
it 'returns an error response if repo can\'t be found' do
response = get '/requests', { repository_id: 0 }, headers
JSON.parse(response.body)['error'].should == "Repository could not be found"
end
end