diff --git a/Gemfile.lock b/Gemfile.lock index 055ffb2d..a50b912e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,7 +42,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 23c0c1b07f34033e598f02bfd03ec99b01198fce + revision: 27275b7f26023cf8e1379cca9a9760f46dc9a45c specs: travis-core (0.0.1) actionmailer (~> 3.2.3) diff --git a/spec/integration/v2/repositories_spec.rb b/spec/integration/v2/repositories_spec.rb index 5d5d0662..a4de23a4 100644 --- a/spec/integration/v2/repositories_spec.rb +++ b/spec/integration/v2/repositories_spec.rb @@ -31,14 +31,19 @@ describe 'Repos' do response.should deliver_json_for(Repository.by_slug('svenfuchs/minimal').first, version: 'v2') end + it 'GET /repos/1/cc.xml' do + response = get "repos/#{repo.id}/cc.xml" + response.should deliver_cc_xml_for(Repository.by_slug('svenfuchs/minimal').first) + end + it 'GET /repos/svenfuchs/minimal' do response = get '/repos/svenfuchs/minimal', {}, headers response.should deliver_json_for(Repository.by_slug('svenfuchs/minimal').first, version: 'v2') end it 'GET /repos/svenfuchs/minimal/cc.xml' do - response = get '/repos/svenfuchs/minimal/cc.xml', {}, headers - response.should deliver_xml_for(Repository.by_slug('svenfuchs/minimal').first, version: 'v2') + response = get '/repos/svenfuchs/minimal/cc.xml' + response.should deliver_cc_xml_for(Repository.by_slug('svenfuchs/minimal').first) end describe 'GET /repos/svenfuchs/minimal.png?branch=foo,bar' do diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 0871c220..3b39e8bb 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -45,6 +45,18 @@ RSpec::Matchers.define :deliver_result_image_for do |name| end end +RSpec::Matchers.define :deliver_cc_xml_for do |repo| + match do |response| + body = response.body + + failure_message_for_should do + "expected #{body} to be a valid cc.xml" + end + + body.include?('') && body.include?(%(name="#{repo.slug}")) + end +end + RSpec::Matchers.define :redirect_to do |expected| match do |response| actual = response.headers['location'].to_s.sub('http://example.org', '')