@@ -37,6 +37,23 class SysController < ActionController::Base | |||
|
37 | 37 | end |
|
38 | 38 | end |
|
39 | 39 | end |
|
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 | |
|
40 | 57 | |
|
41 | 58 | protected |
|
42 | 59 |
@@ -53,4 +53,19 class SysControllerTest < ActionController::TestCase | |||
|
53 | 53 | assert r.is_a?(Repository::Subversion) |
|
54 | 54 | assert_equal 'file:///create/project/repository/subproject2', r.url |
|
55 | 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 | 71 | end |
General Comments 0
You need to be logged in to leave comments.
Login now