fix tests for cc.xml
This commit is contained in:
parent
f7fdfaa96a
commit
ab841a0a23
|
@ -42,7 +42,7 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/travis-ci/travis-core.git
|
remote: git://github.com/travis-ci/travis-core.git
|
||||||
revision: 23c0c1b07f34033e598f02bfd03ec99b01198fce
|
revision: 27275b7f26023cf8e1379cca9a9760f46dc9a45c
|
||||||
specs:
|
specs:
|
||||||
travis-core (0.0.1)
|
travis-core (0.0.1)
|
||||||
actionmailer (~> 3.2.3)
|
actionmailer (~> 3.2.3)
|
||||||
|
|
|
@ -31,14 +31,19 @@ describe 'Repos' do
|
||||||
response.should deliver_json_for(Repository.by_slug('svenfuchs/minimal').first, version: 'v2')
|
response.should deliver_json_for(Repository.by_slug('svenfuchs/minimal').first, version: 'v2')
|
||||||
end
|
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
|
it 'GET /repos/svenfuchs/minimal' do
|
||||||
response = get '/repos/svenfuchs/minimal', {}, headers
|
response = get '/repos/svenfuchs/minimal', {}, headers
|
||||||
response.should deliver_json_for(Repository.by_slug('svenfuchs/minimal').first, version: 'v2')
|
response.should deliver_json_for(Repository.by_slug('svenfuchs/minimal').first, version: 'v2')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'GET /repos/svenfuchs/minimal/cc.xml' do
|
it 'GET /repos/svenfuchs/minimal/cc.xml' do
|
||||||
response = get '/repos/svenfuchs/minimal/cc.xml', {}, headers
|
response = get '/repos/svenfuchs/minimal/cc.xml'
|
||||||
response.should deliver_xml_for(Repository.by_slug('svenfuchs/minimal').first, version: 'v2')
|
response.should deliver_cc_xml_for(Repository.by_slug('svenfuchs/minimal').first)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET /repos/svenfuchs/minimal.png?branch=foo,bar' do
|
describe 'GET /repos/svenfuchs/minimal.png?branch=foo,bar' do
|
||||||
|
|
|
@ -45,6 +45,18 @@ RSpec::Matchers.define :deliver_result_image_for do |name|
|
||||||
end
|
end
|
||||||
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?('<Projects>') && body.include?(%(name="#{repo.slug}"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
RSpec::Matchers.define :redirect_to do |expected|
|
RSpec::Matchers.define :redirect_to do |expected|
|
||||||
match do |response|
|
match do |response|
|
||||||
actual = response.headers['location'].to_s.sub('http://example.org', '')
|
actual = response.headers['location'].to_s.sub('http://example.org', '')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user