Don't error out if xml is requested with something else than repo

This commit is contained in:
Piotr Sarnacki 2013-03-12 12:08:40 +01:00
parent c0b9a468d6
commit 705927ff74
2 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,10 @@ module Travis::Api::App::Responders
started: 'Building'
}
def apply?
super && resource.is_a?(Repository)
end
def apply
halt TEMPLATE % data
end

View File

@ -86,6 +86,11 @@ describe 'Repos' do
response.should deliver_cc_xml_for(Repository.by_slug('svenfuchs/minimal').first)
end
it 'does not respond with cc.xml for /repos list' do
response = get '/repos', {}, 'HTTP_ACCEPT' => 'application/xml; version=2'
response.status.should == 406
end
describe 'GET /repos/svenfuchs/minimal.png?branch=foo,bar' do
let(:on_foo) { Factory(:commit, branch: 'foo') }
let(:on_bar) { Factory(:commit, branch: 'bar') }