@@ -0,0 +1,91 | |||
|
1 | # redMine - project management software | |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
|
19 | require 'repositories_controller' | |
|
20 | ||
|
21 | # Re-raise errors caught by the controller. | |
|
22 | class RepositoriesController; def rescue_action(e) raise e end; end | |
|
23 | ||
|
24 | class RepositoriesControllerTest < Test::Unit::TestCase | |
|
25 | fixtures :projects, :users, :roles, :members, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers | |
|
26 | ||
|
27 | # No '..' in the repository path for svn | |
|
28 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository' | |
|
29 | ||
|
30 | def setup | |
|
31 | @controller = RepositoriesController.new | |
|
32 | @request = ActionController::TestRequest.new | |
|
33 | @response = ActionController::TestResponse.new | |
|
34 | User.current = nil | |
|
35 | end | |
|
36 | ||
|
37 | if File.directory?(REPOSITORY_PATH) | |
|
38 | def test_show | |
|
39 | get :show, :id => 1 | |
|
40 | assert_response :success | |
|
41 | assert_template 'show' | |
|
42 | assert_not_nil assigns(:entries) | |
|
43 | assert_not_nil assigns(:changesets) | |
|
44 | end | |
|
45 | ||
|
46 | def test_browse_root | |
|
47 | get :browse, :id => 1 | |
|
48 | assert_response :success | |
|
49 | assert_template 'browse' | |
|
50 | assert_not_nil assigns(:entries) | |
|
51 | entry = assigns(:entries).detect {|e| e.name == 'subversion_test'} | |
|
52 | assert_equal 'dir', entry.kind | |
|
53 | end | |
|
54 | ||
|
55 | def test_browse_directory | |
|
56 | get :browse, :id => 1, :path => ['subversion_test'] | |
|
57 | assert_response :success | |
|
58 | assert_template 'browse' | |
|
59 | assert_not_nil assigns(:entries) | |
|
60 | entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'} | |
|
61 | assert_equal 'file', entry.kind | |
|
62 | assert_equal 'subversion_test/helloworld.c', entry.path | |
|
63 | end | |
|
64 | ||
|
65 | def test_entry | |
|
66 | get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'] | |
|
67 | assert_response :success | |
|
68 | assert_template 'entry' | |
|
69 | end | |
|
70 | ||
|
71 | def test_entry_download | |
|
72 | get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw' | |
|
73 | assert_response :success | |
|
74 | end | |
|
75 | ||
|
76 | def test_diff | |
|
77 | get :diff, :id => 1, :rev => 3 | |
|
78 | assert_response :success | |
|
79 | assert_template 'diff' | |
|
80 | end | |
|
81 | ||
|
82 | def test_annotate | |
|
83 | get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c'] | |
|
84 | assert_response :success | |
|
85 | assert_template 'annotate' | |
|
86 | end | |
|
87 | else | |
|
88 | puts "Subversion test repository NOT FOUND. Skipping functional tests !!!" | |
|
89 | def test_fake; assert true end | |
|
90 | end | |
|
91 | end |
@@ -1,15 +1,17 | |||
|
1 | 1 | --- |
|
2 | 2 | repositories_001: |
|
3 | 3 | project_id: 1 |
|
4 | url: svn://localhost/test | |
|
4 | url: file:///<%= RAILS_ROOT.gsub(%r{config\/\.\.}, '') %>/tmp/test/subversion_repository | |
|
5 | 5 | id: 10 |
|
6 | root_url: svn://localhost | |
|
6 | root_url: file:///<%= RAILS_ROOT.gsub(%r{config\/\.\.}, '') %>/tmp/test/subversion_repository | |
|
7 | 7 | password: "" |
|
8 | 8 | login: "" |
|
9 | type: Subversion | |
|
9 | 10 | repositories_002: |
|
10 | 11 | project_id: 2 |
|
11 | 12 | url: svn://localhost/test |
|
12 | 13 | id: 11 |
|
13 | 14 | root_url: svn://localhost |
|
14 | 15 | password: "" |
|
15 | 16 | login: "" |
|
17 | type: Subversion |
@@ -1,156 +1,211 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.dirname(__FILE__) + '/../test_helper' |
|
19 | 19 | require 'projects_controller' |
|
20 | 20 | |
|
21 | 21 | # Re-raise errors caught by the controller. |
|
22 | 22 | class ProjectsController; def rescue_action(e) raise e end; end |
|
23 | 23 | |
|
24 | 24 | class ProjectsControllerTest < Test::Unit::TestCase |
|
25 | fixtures :projects, :users, :roles, :members, :issues, :journals, :journal_details, :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations | |
|
25 | fixtures :projects, :versions, :users, :roles, :members, :issues, :journals, :journal_details, :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations | |
|
26 | 26 | |
|
27 | 27 | def setup |
|
28 | 28 | @controller = ProjectsController.new |
|
29 | 29 | @request = ActionController::TestRequest.new |
|
30 | 30 | @response = ActionController::TestResponse.new |
|
31 | 31 | end |
|
32 | 32 | |
|
33 | 33 | def test_index |
|
34 | 34 | get :index |
|
35 | 35 | assert_response :success |
|
36 | 36 | assert_template 'list' |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 39 | def test_list |
|
40 | 40 | get :list |
|
41 | 41 | assert_response :success |
|
42 | 42 | assert_template 'list' |
|
43 | 43 | assert_not_nil assigns(:project_tree) |
|
44 | # Root project as hash key | |
|
45 | assert assigns(:project_tree).has_key?(Project.find(1)) | |
|
46 | # Subproject in corresponding value | |
|
47 | assert assigns(:project_tree)[Project.find(1)].include?(Project.find(3)) | |
|
44 | 48 | end |
|
45 | 49 | |
|
46 | 50 | def test_show |
|
47 | 51 | get :show, :id => 1 |
|
48 | 52 | assert_response :success |
|
49 | 53 | assert_template 'show' |
|
50 | 54 | assert_not_nil assigns(:project) |
|
51 | 55 | end |
|
52 | 56 | |
|
53 | 57 | def test_list_documents |
|
54 | 58 | get :list_documents, :id => 1 |
|
55 | 59 | assert_response :success |
|
56 | 60 | assert_template 'list_documents' |
|
57 | 61 | assert_not_nil assigns(:grouped) |
|
58 | 62 | end |
|
59 | 63 | |
|
60 | 64 | def test_bulk_edit_issues |
|
61 | 65 | @request.session[:user_id] = 2 |
|
62 | 66 | # update issues priority |
|
63 | 67 | post :bulk_edit_issues, :id => 1, :issue_ids => [1, 2], :priority_id => 7, :notes => 'Bulk editing', :assigned_to_id => '' |
|
64 | 68 | assert_response 302 |
|
65 | 69 | # check that the issues were updated |
|
66 | 70 | assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id} |
|
67 | 71 | assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes |
|
68 | 72 | end |
|
69 | 73 | |
|
70 | 74 | def test_list_files |
|
71 | 75 | get :list_files, :id => 1 |
|
72 | 76 | assert_response :success |
|
73 | 77 | assert_template 'list_files' |
|
74 | 78 | assert_not_nil assigns(:versions) |
|
75 | 79 | end |
|
76 | 80 | |
|
77 | 81 | def test_changelog |
|
78 | 82 | get :changelog, :id => 1 |
|
79 | 83 | assert_response :success |
|
80 | 84 | assert_template 'changelog' |
|
81 | 85 | assert_not_nil assigns(:versions) |
|
82 | 86 | end |
|
83 | 87 | |
|
84 | 88 | def test_roadmap |
|
85 | 89 | get :roadmap, :id => 1 |
|
86 | 90 | assert_response :success |
|
87 | 91 | assert_template 'roadmap' |
|
88 | 92 | assert_not_nil assigns(:versions) |
|
93 | # Version with no date set appears | |
|
94 | assert assigns(:versions).include?(Version.find(3)) | |
|
95 | # Completed version doesn't appear | |
|
96 | assert !assigns(:versions).include?(Version.find(1)) | |
|
97 | end | |
|
98 | ||
|
99 | def test_roadmap_with_completed_versions | |
|
100 | get :roadmap, :id => 1, :completed => 1 | |
|
101 | assert_response :success | |
|
102 | assert_template 'roadmap' | |
|
103 | assert_not_nil assigns(:versions) | |
|
104 | # Version with no date set appears | |
|
105 | assert assigns(:versions).include?(Version.find(3)) | |
|
106 | # Completed version appears | |
|
107 | assert assigns(:versions).include?(Version.find(1)) | |
|
89 | 108 | end |
|
90 | 109 | |
|
91 | 110 | def test_activity |
|
92 | 111 | get :activity, :id => 1, :year => 2.days.ago.to_date.year, :month => 2.days.ago.to_date.month |
|
93 | 112 | assert_response :success |
|
94 | 113 | assert_template 'activity' |
|
95 | 114 | assert_not_nil assigns(:events_by_day) |
|
96 | 115 | |
|
97 | 116 | assert_tag :tag => "h3", |
|
98 | 117 | :content => /#{2.days.ago.to_date.day}/, |
|
99 | 118 | :sibling => { :tag => "ul", |
|
100 | 119 | :child => { :tag => "li", |
|
101 | 120 | :child => { :tag => "p", |
|
102 | 121 | :content => /(#{IssueStatus.find(2).name})/, |
|
103 | 122 | } |
|
104 | 123 | } |
|
105 | 124 | } |
|
106 | 125 | |
|
107 | 126 | get :activity, :id => 1, :year => 3.days.ago.to_date.year, :month => 3.days.ago.to_date.month |
|
108 | 127 | assert_response :success |
|
109 | 128 | assert_template 'activity' |
|
110 | 129 | assert_not_nil assigns(:events_by_day) |
|
111 | 130 | |
|
112 | 131 | assert_tag :tag => "h3", |
|
113 | 132 | :content => /#{3.day.ago.to_date.day}/, |
|
114 | 133 | :sibling => { :tag => "ul", |
|
115 | 134 | :child => { :tag => "li", |
|
116 | 135 | :child => { :tag => "p", |
|
117 | 136 | :content => /#{Issue.find(1).subject}/, |
|
118 | 137 | } |
|
119 | 138 | } |
|
120 | 139 | } |
|
121 | 140 | end |
|
122 | 141 | |
|
142 | def test_calendar | |
|
143 | get :calendar, :id => 1 | |
|
144 | assert_response :success | |
|
145 | assert_template 'calendar' | |
|
146 | assert_not_nil assigns(:calendar) | |
|
147 | end | |
|
148 | ||
|
149 | def test_calendar_with_subprojects | |
|
150 | get :calendar, :id => 1, :with_subprojects => 1, :tracker_ids => [1, 2] | |
|
151 | assert_response :success | |
|
152 | assert_template 'calendar' | |
|
153 | assert_not_nil assigns(:calendar) | |
|
154 | end | |
|
155 | ||
|
156 | def test_gantt | |
|
157 | get :gantt, :id => 1 | |
|
158 | assert_response :success | |
|
159 | assert_template 'gantt.rhtml' | |
|
160 | assert_not_nil assigns(:events) | |
|
161 | end | |
|
162 | ||
|
163 | def test_gantt_with_subprojects | |
|
164 | get :gantt, :id => 1, :with_subprojects => 1, :tracker_ids => [1, 2] | |
|
165 | assert_response :success | |
|
166 | assert_template 'gantt.rhtml' | |
|
167 | assert_not_nil assigns(:events) | |
|
168 | end | |
|
169 | ||
|
170 | def test_gantt_export_to_pdf | |
|
171 | get :gantt, :id => 1, :format => 'pdf' | |
|
172 | assert_response :success | |
|
173 | assert_template 'gantt.rfpdf' | |
|
174 | assert_equal 'application/pdf', @response.content_type | |
|
175 | assert_not_nil assigns(:events) | |
|
176 | end | |
|
177 | ||
|
123 | 178 | def test_archive |
|
124 | 179 | @request.session[:user_id] = 1 # admin |
|
125 | 180 | post :archive, :id => 1 |
|
126 | 181 | assert_redirected_to 'admin/projects' |
|
127 | 182 | assert !Project.find(1).active? |
|
128 | 183 | end |
|
129 | 184 | |
|
130 | 185 | def test_unarchive |
|
131 | 186 | @request.session[:user_id] = 1 # admin |
|
132 | 187 | Project.find(1).archive |
|
133 | 188 | post :unarchive, :id => 1 |
|
134 | 189 | assert_redirected_to 'admin/projects' |
|
135 | 190 | assert Project.find(1).active? |
|
136 | 191 | end |
|
137 | 192 | |
|
138 | 193 | def test_add_issue |
|
139 | 194 | @request.session[:user_id] = 2 |
|
140 | 195 | get :add_issue, :id => 1, :tracker_id => 1 |
|
141 | 196 | assert_response :success |
|
142 | 197 | assert_template 'add_issue' |
|
143 | 198 | post :add_issue, :id => 1, :issue => {:tracker_id => 1, :subject => 'This is the test_add_issue issue', :description => 'This is the description', :priority_id => 5} |
|
144 | 199 | assert_redirected_to 'projects/1/issues' |
|
145 | 200 | assert Issue.find_by_subject('This is the test_add_issue issue') |
|
146 | 201 | end |
|
147 | 202 | |
|
148 | 203 | def test_copy_issue |
|
149 | 204 | @request.session[:user_id] = 2 |
|
150 | 205 | get :add_issue, :id => 1, :copy_from => 1 |
|
151 | 206 | assert_template 'add_issue' |
|
152 | 207 | assert_not_nil assigns(:issue) |
|
153 | 208 | orig = Issue.find(1) |
|
154 | 209 | assert_equal orig.subject, assigns(:issue).subject |
|
155 | 210 | end |
|
156 | 211 | end |
@@ -1,46 +1,64 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.dirname(__FILE__) + '/../test_helper' |
|
19 | 19 | require 'repositories_controller' |
|
20 | 20 | |
|
21 | 21 | # Re-raise errors caught by the controller. |
|
22 | 22 | class RepositoriesController; def rescue_action(e) raise e end; end |
|
23 | 23 | |
|
24 | 24 | class RepositoriesControllerTest < Test::Unit::TestCase |
|
25 | 25 | fixtures :projects, :users, :roles, :members, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers |
|
26 | 26 | |
|
27 | 27 | def setup |
|
28 | 28 | @controller = RepositoriesController.new |
|
29 | 29 | @request = ActionController::TestRequest.new |
|
30 | 30 | @response = ActionController::TestResponse.new |
|
31 | 31 | User.current = nil |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | def test_revisions | |
|
35 | get :revisions, :id => 1 | |
|
36 | assert_response :success | |
|
37 | assert_template 'revisions' | |
|
38 | assert_not_nil assigns(:changesets) | |
|
39 | end | |
|
40 | ||
|
34 | 41 | def test_revision_with_before_nil_and_afer_normal |
|
35 | 42 | get :revision, {:id => 1, :rev => 1} |
|
36 | 43 | assert_response :success |
|
37 | 44 | assert_template 'revision' |
|
38 | 45 | assert_no_tag :tag => "div", :attributes => { :class => "contextual" }, |
|
39 | 46 | :child => { :tag => "a", :attributes => { :href => '/repositories/revision/1?rev=0'} |
|
40 | 47 | } |
|
41 | 48 | assert_tag :tag => "div", :attributes => { :class => "contextual" }, |
|
42 | 49 | :child => { :tag => "a", :attributes => { :href => '/repositories/revision/1?rev=2'} |
|
43 | 50 | } |
|
44 | 51 | end |
|
45 | 52 | |
|
53 | def test_graph_commits_per_month | |
|
54 | get :graph, :id => 1, :graph => 'commits_per_month' | |
|
55 | assert_response :success | |
|
56 | assert_equal 'image/svg+xml', @response.content_type | |
|
57 | end | |
|
58 | ||
|
59 | def test_graph_commits_per_author | |
|
60 | get :graph, :id => 1, :graph => 'commits_per_author' | |
|
61 | assert_response :success | |
|
62 | assert_equal 'image/svg+xml', @response.content_type | |
|
63 | end | |
|
46 | 64 | end |
@@ -1,87 +1,87 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.dirname(__FILE__) + '/../test_helper' |
|
19 | 19 | |
|
20 | 20 | class RepositoryBazaarTest < Test::Unit::TestCase |
|
21 | 21 | fixtures :projects |
|
22 | 22 | |
|
23 | 23 | # No '..' in the repository path |
|
24 | 24 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + 'tmp/test/bazaar_repository' |
|
25 | 25 | |
|
26 | 26 | def setup |
|
27 | 27 | @project = Project.find(1) |
|
28 | 28 | assert @repository = Repository::Bazaar.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}") |
|
29 | 29 | end |
|
30 | 30 | |
|
31 | 31 | if File.directory?(REPOSITORY_PATH) |
|
32 | 32 | def test_fetch_changesets_from_scratch |
|
33 | 33 | @repository.fetch_changesets |
|
34 | 34 | @repository.reload |
|
35 | 35 | |
|
36 | 36 | assert_equal 4, @repository.changesets.count |
|
37 | 37 | assert_equal 9, @repository.changes.count |
|
38 | 38 | assert_equal 'Initial import', @repository.changesets.find_by_revision(1).comments |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | def test_fetch_changesets_incremental |
|
42 | 42 | @repository.fetch_changesets |
|
43 | 43 | # Remove changesets with revision > 5 |
|
44 | 44 | @repository.changesets.find(:all, :conditions => 'revision > 2').each(&:destroy) |
|
45 | 45 | @repository.reload |
|
46 | 46 | assert_equal 2, @repository.changesets.count |
|
47 | 47 | |
|
48 | 48 | @repository.fetch_changesets |
|
49 | 49 | assert_equal 4, @repository.changesets.count |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | def test_entries |
|
53 | 53 | entries = @repository.entries |
|
54 | 54 | assert_equal 2, entries.size |
|
55 | 55 | |
|
56 | 56 | assert_equal 'dir', entries[0].kind |
|
57 | 57 | assert_equal 'directory', entries[0].name |
|
58 | 58 | |
|
59 | 59 | assert_equal 'file', entries[1].kind |
|
60 | 60 | assert_equal 'doc-mkdir.txt', entries[1].name |
|
61 | 61 | end |
|
62 | 62 | |
|
63 | 63 | def test_entries_in_subdirectory |
|
64 | 64 | entries = @repository.entries('directory') |
|
65 | 65 | assert_equal 3, entries.size |
|
66 | 66 | |
|
67 | 67 | assert_equal 'file', entries.last.kind |
|
68 | 68 | assert_equal 'edit.png', entries.last.name |
|
69 | 69 | end |
|
70 | 70 | |
|
71 | 71 | def test_cat |
|
72 | 72 | cat = @repository.scm.cat('directory/document.txt') |
|
73 | 73 | assert cat =~ /Write the contents of a file as of a given revision to standard output/ |
|
74 | 74 | end |
|
75 | 75 | |
|
76 | 76 | def test_annotate |
|
77 | 77 | annotate = @repository.scm.annotate('doc-mkdir.txt') |
|
78 | 78 | assert_equal 17, annotate.lines.size |
|
79 | 79 | assert_equal 1, annotate.revisions[0].identifier |
|
80 | 80 | assert_equal 'jsmith@', annotate.revisions[0].author |
|
81 | 81 | assert_equal 'mkdir', annotate.lines[0] |
|
82 | 82 | end |
|
83 | 83 | else |
|
84 | puts "Bazaar test repository NOT FOUND. Skipping tests !!!" | |
|
84 | puts "Bazaar test repository NOT FOUND. Skipping unit tests !!!" | |
|
85 | 85 | def test_fake; assert true end |
|
86 | 86 | end |
|
87 | 87 | end |
@@ -1,55 +1,55 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.dirname(__FILE__) + '/../test_helper' |
|
19 | 19 | |
|
20 | 20 | class RepositorySubversionTest < Test::Unit::TestCase |
|
21 | 21 | fixtures :projects |
|
22 | 22 | |
|
23 | 23 | # No '..' in the repository path for svn |
|
24 | 24 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository' |
|
25 | 25 | |
|
26 | 26 | def setup |
|
27 | 27 | @project = Project.find(1) |
|
28 | 28 | assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}") |
|
29 | 29 | end |
|
30 | 30 | |
|
31 | 31 | if File.directory?(REPOSITORY_PATH) |
|
32 | 32 | def test_fetch_changesets_from_scratch |
|
33 | 33 | @repository.fetch_changesets |
|
34 | 34 | @repository.reload |
|
35 | 35 | |
|
36 | 36 | assert_equal 8, @repository.changesets.count |
|
37 | 37 | assert_equal 16, @repository.changes.count |
|
38 | 38 | assert_equal 'Initial import.', @repository.changesets.find_by_revision(1).comments |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | def test_fetch_changesets_incremental |
|
42 | 42 | @repository.fetch_changesets |
|
43 | 43 | # Remove changesets with revision > 5 |
|
44 | 44 | @repository.changesets.find(:all, :conditions => 'revision > 5').each(&:destroy) |
|
45 | 45 | @repository.reload |
|
46 | 46 | assert_equal 5, @repository.changesets.count |
|
47 | 47 | |
|
48 | 48 | @repository.fetch_changesets |
|
49 | 49 | assert_equal 8, @repository.changesets.count |
|
50 | 50 | end |
|
51 | 51 | else |
|
52 | puts "Subversion test repository NOT FOUND. Skipping tests !!!" | |
|
52 | puts "Subversion test repository NOT FOUND. Skipping unit tests !!!" | |
|
53 | 53 | def test_fake; assert true end |
|
54 | 54 | end |
|
55 | 55 | end |
General Comments 0
You need to be logged in to leave comments.
Login now