@@ -38,6 +38,23 class SysController < ActionController::Base | |||||
38 | end |
|
38 | end | |
39 | end |
|
39 | end | |
40 |
|
40 | |||
|
41 | def fetch_changesets | |||
|
42 | projects = [] | |||
|
43 | if params[:id] | |||
|
44 | projects << Project.active.has_module(:repository).find(params[:id]) | |||
|
45 | else | |||
|
46 | projects = Project.active.has_module(:repository).find(:all, :include => :repository) | |||
|
47 | end | |||
|
48 | projects.each do |project| | |||
|
49 | if project.repository | |||
|
50 | project.repository.fetch_changesets | |||
|
51 | end | |||
|
52 | end | |||
|
53 | render :nothing => true, :status => 200 | |||
|
54 | rescue ActiveRecord::RecordNotFound | |||
|
55 | render :nothing => true, :status => 404 | |||
|
56 | end | |||
|
57 | ||||
41 | protected |
|
58 | protected | |
42 |
|
59 | |||
43 | def check_enabled |
|
60 | def check_enabled |
@@ -53,4 +53,19 class SysControllerTest < ActionController::TestCase | |||||
53 | assert r.is_a?(Repository::Subversion) |
|
53 | assert r.is_a?(Repository::Subversion) | |
54 | assert_equal 'file:///create/project/repository/subproject2', r.url |
|
54 | assert_equal 'file:///create/project/repository/subproject2', r.url | |
55 | end |
|
55 | end | |
|
56 | ||||
|
57 | def test_fetch_changesets | |||
|
58 | get :fetch_changesets | |||
|
59 | assert_response :success | |||
|
60 | end | |||
|
61 | ||||
|
62 | def test_fetch_changesets_one_project | |||
|
63 | get :fetch_changesets, :id => 'ecookbook' | |||
|
64 | assert_response :success | |||
|
65 | end | |||
|
66 | ||||
|
67 | def test_fetch_changesets_unknown_project | |||
|
68 | get :fetch_changesets, :id => 'unknown' | |||
|
69 | assert_response 404 | |||
|
70 | end | |||
56 | end |
|
71 | end |
General Comments 0
You need to be logged in to leave comments.
Login now