@@ -20,7 +20,8 class SysController < ActionController::Base | |||
|
20 | 20 | |
|
21 | 21 | def projects |
|
22 | 22 | p = Project.active.has_module(:repository).find(:all, :include => :repository, :order => 'identifier') |
|
23 | render :xml => p.to_xml(:include => :repository) | |
|
23 | # extra_info attribute from repository breaks activeresource client | |
|
24 | render :xml => p.to_xml(:only => [:id, :identifier, :name, :is_public, :status], :include => {:repository => {:only => [:id, :url]}}) | |
|
24 | 25 | end |
|
25 | 26 | |
|
26 | 27 | def create_project_repository |
@@ -31,7 +32,7 class SysController < ActionController::Base | |||
|
31 | 32 | logger.info "Repository for #{project.name} was reported to be created by #{request.remote_ip}." |
|
32 | 33 | project.repository = Repository.factory(params[:vendor], params[:repository]) |
|
33 | 34 | if project.repository && project.repository.save |
|
34 | render :xml => project.repository, :status => 201 | |
|
35 | render :xml => project.repository.to_xml(:only => [:id, :url]), :status => 201 | |
|
35 | 36 | else |
|
36 | 37 | render :nothing => true, :status => 422 |
|
37 | 38 | end |
@@ -39,7 +39,10 class SysControllerTest < ActionController::TestCase | |||
|
39 | 39 | assert_equal 'application/xml', @response.content_type |
|
40 | 40 | with_options :tag => 'projects' do |test| |
|
41 | 41 | test.assert_tag :children => { :count => Project.active.has_module(:repository).count } |
|
42 | test.assert_tag 'project', :child => {:tag => 'identifier', :sibling => {:tag => 'is-public'}} | |
|
42 | 43 | end |
|
44 | assert_no_tag 'extra-info' | |
|
45 | assert_no_tag 'extra_info' | |
|
43 | 46 | end |
|
44 | 47 | |
|
45 | 48 | def test_create_project_repository |
@@ -49,10 +52,19 class SysControllerTest < ActionController::TestCase | |||
|
49 | 52 | :vendor => 'Subversion', |
|
50 | 53 | :repository => { :url => 'file:///create/project/repository/subproject2'} |
|
51 | 54 | assert_response :created |
|
55 | assert_equal 'application/xml', @response.content_type | |
|
52 | 56 | |
|
53 | 57 | r = Project.find(4).repository |
|
54 | 58 | assert r.is_a?(Repository::Subversion) |
|
55 | 59 | assert_equal 'file:///create/project/repository/subproject2', r.url |
|
60 | ||
|
61 | assert_tag 'repository-subversion', | |
|
62 | :child => { | |
|
63 | :tag => 'id', :content => r.id.to_s, | |
|
64 | :sibling => {:tag => 'url', :content => r.url} | |
|
65 | } | |
|
66 | assert_no_tag 'extra-info' | |
|
67 | assert_no_tag 'extra_info' | |
|
56 | 68 | end |
|
57 | 69 | |
|
58 | 70 | def test_fetch_changesets |
General Comments 0
You need to be logged in to leave comments.
Login now