##// END OF EJS Templates
Rails3: scm: subversion: fix error of test_browse_root at functional test...
Toshi MARUYAMA -
r7075:89476adc7f5b
parent child
Show More
@@ -1,361 +1,363
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
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
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.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19 require 'repositories_controller'
19 require 'repositories_controller'
20
20
21 # Re-raise errors caught by the controller.
21 # Re-raise errors caught by the controller.
22 class RepositoriesController; def rescue_action(e) raise e end; end
22 class RepositoriesController; def rescue_action(e) raise e end; end
23
23
24 class RepositoriesSubversionControllerTest < ActionController::TestCase
24 class RepositoriesSubversionControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules,
25 fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules,
26 :repositories, :issues, :issue_statuses, :changesets, :changes,
26 :repositories, :issues, :issue_statuses, :changesets, :changes,
27 :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
27 :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
28
28
29 PRJ_ID = 3
29 PRJ_ID = 3
30 NUM_REV = 11
30 NUM_REV = 11
31
31
32 def setup
32 def setup
33 @controller = RepositoriesController.new
33 @controller = RepositoriesController.new
34 @request = ActionController::TestRequest.new
34 @request = ActionController::TestRequest.new
35 @response = ActionController::TestResponse.new
35 @response = ActionController::TestResponse.new
36 Setting.default_language = 'en'
36 Setting.default_language = 'en'
37 User.current = nil
37 User.current = nil
38
38
39 @project = Project.find(PRJ_ID)
39 @project = Project.find(PRJ_ID)
40 @repository = Repository::Subversion.create(:project => @project,
40 @repository = Repository::Subversion.create(:project => @project,
41 :url => self.class.subversion_repository_url)
41 :url => self.class.subversion_repository_url)
42 assert @repository
42 assert @repository
43 end
43 end
44
44
45 if repository_configured?('subversion')
45 if repository_configured?('subversion')
46 def test_show
46 def test_show
47 assert_equal 0, @repository.changesets.count
47 assert_equal 0, @repository.changesets.count
48 @repository.fetch_changesets
48 @repository.fetch_changesets
49 @project.reload
49 @project.reload
50 assert_equal NUM_REV, @repository.changesets.count
50 assert_equal NUM_REV, @repository.changesets.count
51 get :show, :id => PRJ_ID
51 get :show, :id => PRJ_ID
52 assert_response :success
52 assert_response :success
53 assert_template 'show'
53 assert_template 'show'
54 assert_not_nil assigns(:entries)
54 assert_not_nil assigns(:entries)
55 assert_not_nil assigns(:changesets)
55 assert_not_nil assigns(:changesets)
56 end
56 end
57
57
58 def test_browse_root
58 def test_browse_root
59 assert_equal 0, @repository.changesets.count
59 @repository.fetch_changesets
60 @repository.fetch_changesets
60 @repository.reload
61 @project.reload
62 assert_equal NUM_REV, @repository.changesets.count
61 get :show, :id => PRJ_ID
63 get :show, :id => PRJ_ID
62 assert_response :success
64 assert_response :success
63 assert_template 'show'
65 assert_template 'show'
64 assert_not_nil assigns(:entries)
66 assert_not_nil assigns(:entries)
65 entry = assigns(:entries).detect {|e| e.name == 'subversion_test'}
67 entry = assigns(:entries).detect {|e| e.name == 'subversion_test'}
66 assert_equal 'dir', entry.kind
68 assert_equal 'dir', entry.kind
67 end
69 end
68
70
69 def test_browse_directory
71 def test_browse_directory
70 @repository.fetch_changesets
72 @repository.fetch_changesets
71 @repository.reload
73 @repository.reload
72 get :show, :id => PRJ_ID, :path => ['subversion_test']
74 get :show, :id => PRJ_ID, :path => ['subversion_test']
73 assert_response :success
75 assert_response :success
74 assert_template 'show'
76 assert_template 'show'
75 assert_not_nil assigns(:entries)
77 assert_not_nil assigns(:entries)
76 assert_equal [
78 assert_equal [
77 '[folder_with_brackets]', 'folder', '.project',
79 '[folder_with_brackets]', 'folder', '.project',
78 'helloworld.c', 'textfile.txt'
80 'helloworld.c', 'textfile.txt'
79 ],
81 ],
80 assigns(:entries).collect(&:name)
82 assigns(:entries).collect(&:name)
81 entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'}
83 entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'}
82 assert_equal 'file', entry.kind
84 assert_equal 'file', entry.kind
83 assert_equal 'subversion_test/helloworld.c', entry.path
85 assert_equal 'subversion_test/helloworld.c', entry.path
84 assert_tag :a, :content => 'helloworld.c', :attributes => { :class => /text\-x\-c/ }
86 assert_tag :a, :content => 'helloworld.c', :attributes => { :class => /text\-x\-c/ }
85 end
87 end
86
88
87 def test_browse_at_given_revision
89 def test_browse_at_given_revision
88 @repository.fetch_changesets
90 @repository.fetch_changesets
89 @repository.reload
91 @repository.reload
90 get :show, :id => PRJ_ID, :path => ['subversion_test'], :rev => 4
92 get :show, :id => PRJ_ID, :path => ['subversion_test'], :rev => 4
91 assert_response :success
93 assert_response :success
92 assert_template 'show'
94 assert_template 'show'
93 assert_not_nil assigns(:entries)
95 assert_not_nil assigns(:entries)
94 assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'],
96 assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'],
95 assigns(:entries).collect(&:name)
97 assigns(:entries).collect(&:name)
96 end
98 end
97
99
98 def test_file_changes
100 def test_file_changes
99 @repository.fetch_changesets
101 @repository.fetch_changesets
100 @repository.reload
102 @repository.reload
101 get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
103 get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
102 assert_response :success
104 assert_response :success
103 assert_template 'changes'
105 assert_template 'changes'
104
106
105 changesets = assigns(:changesets)
107 changesets = assigns(:changesets)
106 assert_not_nil changesets
108 assert_not_nil changesets
107 assert_equal %w(6 3 2), changesets.collect(&:revision)
109 assert_equal %w(6 3 2), changesets.collect(&:revision)
108
110
109 # svn properties displayed with svn >= 1.5 only
111 # svn properties displayed with svn >= 1.5 only
110 if Redmine::Scm::Adapters::SubversionAdapter.client_version_above?([1, 5, 0])
112 if Redmine::Scm::Adapters::SubversionAdapter.client_version_above?([1, 5, 0])
111 assert_not_nil assigns(:properties)
113 assert_not_nil assigns(:properties)
112 assert_equal 'native', assigns(:properties)['svn:eol-style']
114 assert_equal 'native', assigns(:properties)['svn:eol-style']
113 assert_tag :ul,
115 assert_tag :ul,
114 :child => { :tag => 'li',
116 :child => { :tag => 'li',
115 :child => { :tag => 'b', :content => 'svn:eol-style' },
117 :child => { :tag => 'b', :content => 'svn:eol-style' },
116 :child => { :tag => 'span', :content => 'native' } }
118 :child => { :tag => 'span', :content => 'native' } }
117 end
119 end
118 end
120 end
119
121
120 def test_directory_changes
122 def test_directory_changes
121 @repository.fetch_changesets
123 @repository.fetch_changesets
122 @repository.reload
124 @repository.reload
123 get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder' ]
125 get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder' ]
124 assert_response :success
126 assert_response :success
125 assert_template 'changes'
127 assert_template 'changes'
126
128
127 changesets = assigns(:changesets)
129 changesets = assigns(:changesets)
128 assert_not_nil changesets
130 assert_not_nil changesets
129 assert_equal %w(10 9 7 6 5 2), changesets.collect(&:revision)
131 assert_equal %w(10 9 7 6 5 2), changesets.collect(&:revision)
130 end
132 end
131
133
132 def test_entry
134 def test_entry
133 @repository.fetch_changesets
135 @repository.fetch_changesets
134 @repository.reload
136 @repository.reload
135 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
137 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
136 assert_response :success
138 assert_response :success
137 assert_template 'entry'
139 assert_template 'entry'
138 end
140 end
139
141
140 def test_entry_should_send_if_too_big
142 def test_entry_should_send_if_too_big
141 @repository.fetch_changesets
143 @repository.fetch_changesets
142 @repository.reload
144 @repository.reload
143 # no files in the test repo is larger than 1KB...
145 # no files in the test repo is larger than 1KB...
144 with_settings :file_max_size_displayed => 0 do
146 with_settings :file_max_size_displayed => 0 do
145 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
147 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
146 assert_response :success
148 assert_response :success
147 assert_template ''
149 assert_template ''
148 assert_equal 'attachment; filename="helloworld.c"',
150 assert_equal 'attachment; filename="helloworld.c"',
149 @response.headers['Content-Disposition']
151 @response.headers['Content-Disposition']
150 end
152 end
151 end
153 end
152
154
153 def test_entry_at_given_revision
155 def test_entry_at_given_revision
154 @repository.fetch_changesets
156 @repository.fetch_changesets
155 @repository.reload
157 @repository.reload
156 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
158 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
157 assert_response :success
159 assert_response :success
158 assert_template 'entry'
160 assert_template 'entry'
159 # this line was removed in r3 and file was moved in r6
161 # this line was removed in r3 and file was moved in r6
160 assert_tag :tag => 'td', :attributes => { :class => /line-code/},
162 assert_tag :tag => 'td', :attributes => { :class => /line-code/},
161 :content => /Here's the code/
163 :content => /Here's the code/
162 end
164 end
163
165
164 def test_entry_not_found
166 def test_entry_not_found
165 @repository.fetch_changesets
167 @repository.fetch_changesets
166 @repository.reload
168 @repository.reload
167 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'zzz.c']
169 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'zzz.c']
168 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
170 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
169 :content => /The entry or revision was not found in the repository/
171 :content => /The entry or revision was not found in the repository/
170 end
172 end
171
173
172 def test_entry_download
174 def test_entry_download
173 @repository.fetch_changesets
175 @repository.fetch_changesets
174 @repository.reload
176 @repository.reload
175 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
177 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
176 assert_response :success
178 assert_response :success
177 assert_template ''
179 assert_template ''
178 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
180 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
179 end
181 end
180
182
181 def test_directory_entry
183 def test_directory_entry
182 assert_equal 0, @repository.changesets.count
184 assert_equal 0, @repository.changesets.count
183 @repository.fetch_changesets
185 @repository.fetch_changesets
184 @project.reload
186 @project.reload
185 assert_equal NUM_REV, @repository.changesets.count
187 assert_equal NUM_REV, @repository.changesets.count
186 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'folder']
188 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'folder']
187 assert_response :success
189 assert_response :success
188 assert_template 'show'
190 assert_template 'show'
189 assert_not_nil assigns(:entry)
191 assert_not_nil assigns(:entry)
190 assert_equal 'folder', assigns(:entry).name
192 assert_equal 'folder', assigns(:entry).name
191 end
193 end
192
194
193 # TODO: this test needs fixtures.
195 # TODO: this test needs fixtures.
194 def test_revision
196 def test_revision
195 @repository.fetch_changesets
197 @repository.fetch_changesets
196 @repository.reload
198 @repository.reload
197 get :revision, :id => 1, :rev => 2
199 get :revision, :id => 1, :rev => 2
198 assert_response :success
200 assert_response :success
199 assert_template 'revision'
201 assert_template 'revision'
200 assert_tag :tag => 'ul',
202 assert_tag :tag => 'ul',
201 :child => { :tag => 'li',
203 :child => { :tag => 'li',
202 # link to the entry at rev 2
204 # link to the entry at rev 2
203 :child => { :tag => 'a',
205 :child => { :tag => 'a',
204 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/test/some/path/in/the/repo'},
206 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/test/some/path/in/the/repo'},
205 :content => 'repo',
207 :content => 'repo',
206 # link to partial diff
208 # link to partial diff
207 :sibling => { :tag => 'a',
209 :sibling => { :tag => 'a',
208 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo' }
210 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo' }
209 }
211 }
210 }
212 }
211 }
213 }
212 end
214 end
213
215
214 def test_invalid_revision
216 def test_invalid_revision
215 assert_equal 0, @repository.changesets.count
217 assert_equal 0, @repository.changesets.count
216 @repository.fetch_changesets
218 @repository.fetch_changesets
217 @project.reload
219 @project.reload
218 assert_equal NUM_REV, @repository.changesets.count
220 assert_equal NUM_REV, @repository.changesets.count
219 get :revision, :id => PRJ_ID, :rev => 'something_weird'
221 get :revision, :id => PRJ_ID, :rev => 'something_weird'
220 assert_response 404
222 assert_response 404
221 assert_error_tag :content => /was not found/
223 assert_error_tag :content => /was not found/
222 end
224 end
223
225
224 def test_invalid_revision_diff
226 def test_invalid_revision_diff
225 get :diff, :id => PRJ_ID, :rev => '1', :rev_to => 'something_weird'
227 get :diff, :id => PRJ_ID, :rev => '1', :rev_to => 'something_weird'
226 assert_response 404
228 assert_response 404
227 assert_error_tag :content => /was not found/
229 assert_error_tag :content => /was not found/
228 end
230 end
229
231
230 def test_empty_revision
232 def test_empty_revision
231 assert_equal 0, @repository.changesets.count
233 assert_equal 0, @repository.changesets.count
232 @repository.fetch_changesets
234 @repository.fetch_changesets
233 @project.reload
235 @project.reload
234 assert_equal NUM_REV, @repository.changesets.count
236 assert_equal NUM_REV, @repository.changesets.count
235 ['', ' ', nil].each do |r|
237 ['', ' ', nil].each do |r|
236 get :revision, :id => PRJ_ID, :rev => r
238 get :revision, :id => PRJ_ID, :rev => r
237 assert_response 404
239 assert_response 404
238 assert_error_tag :content => /was not found/
240 assert_error_tag :content => /was not found/
239 end
241 end
240 end
242 end
241
243
242 # TODO: this test needs fixtures.
244 # TODO: this test needs fixtures.
243 def test_revision_with_repository_pointing_to_a_subdirectory
245 def test_revision_with_repository_pointing_to_a_subdirectory
244 r = Project.find(1).repository
246 r = Project.find(1).repository
245 # Changes repository url to a subdirectory
247 # Changes repository url to a subdirectory
246 r.update_attribute :url, (r.url + '/test/some')
248 r.update_attribute :url, (r.url + '/test/some')
247
249
248 get :revision, :id => 1, :rev => 2
250 get :revision, :id => 1, :rev => 2
249 assert_response :success
251 assert_response :success
250 assert_template 'revision'
252 assert_template 'revision'
251 assert_tag :tag => 'ul',
253 assert_tag :tag => 'ul',
252 :child => { :tag => 'li',
254 :child => { :tag => 'li',
253 # link to the entry at rev 2
255 # link to the entry at rev 2
254 :child => { :tag => 'a',
256 :child => { :tag => 'a',
255 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/path/in/the/repo'},
257 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/path/in/the/repo'},
256 :content => 'repo',
258 :content => 'repo',
257 # link to partial diff
259 # link to partial diff
258 :sibling => { :tag => 'a',
260 :sibling => { :tag => 'a',
259 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo' }
261 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo' }
260 }
262 }
261 }
263 }
262 }
264 }
263 end
265 end
264
266
265 def test_revision_diff
267 def test_revision_diff
266 assert_equal 0, @repository.changesets.count
268 assert_equal 0, @repository.changesets.count
267 @repository.fetch_changesets
269 @repository.fetch_changesets
268 @project.reload
270 @project.reload
269 assert_equal NUM_REV, @repository.changesets.count
271 assert_equal NUM_REV, @repository.changesets.count
270 ['inline', 'sbs'].each do |dt|
272 ['inline', 'sbs'].each do |dt|
271 get :diff, :id => PRJ_ID, :rev => 3, :type => dt
273 get :diff, :id => PRJ_ID, :rev => 3, :type => dt
272 assert_response :success
274 assert_response :success
273 assert_template 'diff'
275 assert_template 'diff'
274 assert_tag :tag => 'h2',
276 assert_tag :tag => 'h2',
275 :content => / 3/
277 :content => / 3/
276 end
278 end
277 end
279 end
278
280
279 def test_directory_diff
281 def test_directory_diff
280 assert_equal 0, @repository.changesets.count
282 assert_equal 0, @repository.changesets.count
281 @repository.fetch_changesets
283 @repository.fetch_changesets
282 @project.reload
284 @project.reload
283 assert_equal NUM_REV, @repository.changesets.count
285 assert_equal NUM_REV, @repository.changesets.count
284 ['inline', 'sbs'].each do |dt|
286 ['inline', 'sbs'].each do |dt|
285 get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2,
287 get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2,
286 :path => ['subversion_test', 'folder'], :type => dt
288 :path => ['subversion_test', 'folder'], :type => dt
287 assert_response :success
289 assert_response :success
288 assert_template 'diff'
290 assert_template 'diff'
289
291
290 diff = assigns(:diff)
292 diff = assigns(:diff)
291 assert_not_nil diff
293 assert_not_nil diff
292 # 2 files modified
294 # 2 files modified
293 assert_equal 2, Redmine::UnifiedDiff.new(diff).size
295 assert_equal 2, Redmine::UnifiedDiff.new(diff).size
294 assert_tag :tag => 'h2', :content => /2:6/
296 assert_tag :tag => 'h2', :content => /2:6/
295 end
297 end
296 end
298 end
297
299
298 def test_annotate
300 def test_annotate
299 assert_equal 0, @repository.changesets.count
301 assert_equal 0, @repository.changesets.count
300 @repository.fetch_changesets
302 @repository.fetch_changesets
301 @project.reload
303 @project.reload
302 assert_equal NUM_REV, @repository.changesets.count
304 assert_equal NUM_REV, @repository.changesets.count
303 get :annotate, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
305 get :annotate, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
304 assert_response :success
306 assert_response :success
305 assert_template 'annotate'
307 assert_template 'annotate'
306 end
308 end
307
309
308 def test_annotate_at_given_revision
310 def test_annotate_at_given_revision
309 assert_equal 0, @repository.changesets.count
311 assert_equal 0, @repository.changesets.count
310 @repository.fetch_changesets
312 @repository.fetch_changesets
311 @project.reload
313 @project.reload
312 assert_equal NUM_REV, @repository.changesets.count
314 assert_equal NUM_REV, @repository.changesets.count
313 get :annotate, :id => PRJ_ID, :rev => 8, :path => ['subversion_test', 'helloworld.c']
315 get :annotate, :id => PRJ_ID, :rev => 8, :path => ['subversion_test', 'helloworld.c']
314 assert_response :success
316 assert_response :success
315 assert_template 'annotate'
317 assert_template 'annotate'
316 assert_tag :tag => 'h2', :content => /@ 8/
318 assert_tag :tag => 'h2', :content => /@ 8/
317 end
319 end
318
320
319 def test_destroy_valid_repository
321 def test_destroy_valid_repository
320 @request.session[:user_id] = 1 # admin
322 @request.session[:user_id] = 1 # admin
321 assert_equal 0, @repository.changesets.count
323 assert_equal 0, @repository.changesets.count
322 @repository.fetch_changesets
324 @repository.fetch_changesets
323 @project.reload
325 @project.reload
324 assert_equal NUM_REV, @repository.changesets.count
326 assert_equal NUM_REV, @repository.changesets.count
325
327
326 get :destroy, :id => PRJ_ID
328 get :destroy, :id => PRJ_ID
327 assert_response 302
329 assert_response 302
328 @project.reload
330 @project.reload
329 assert_nil @project.repository
331 assert_nil @project.repository
330 end
332 end
331
333
332 def test_destroy_invalid_repository
334 def test_destroy_invalid_repository
333 @request.session[:user_id] = 1 # admin
335 @request.session[:user_id] = 1 # admin
334 assert_equal 0, @repository.changesets.count
336 assert_equal 0, @repository.changesets.count
335 @repository.fetch_changesets
337 @repository.fetch_changesets
336 @project.reload
338 @project.reload
337 assert_equal NUM_REV, @repository.changesets.count
339 assert_equal NUM_REV, @repository.changesets.count
338
340
339 get :destroy, :id => PRJ_ID
341 get :destroy, :id => PRJ_ID
340 assert_response 302
342 assert_response 302
341 @project.reload
343 @project.reload
342 assert_nil @project.repository
344 assert_nil @project.repository
343
345
344 @repository = Repository::Subversion.create(
346 @repository = Repository::Subversion.create(
345 :project => @project,
347 :project => @project,
346 :url => "file:///invalid")
348 :url => "file:///invalid")
347 assert @repository
349 assert @repository
348 @repository.fetch_changesets
350 @repository.fetch_changesets
349 @project.reload
351 @project.reload
350 assert_equal 0, @repository.changesets.count
352 assert_equal 0, @repository.changesets.count
351
353
352 get :destroy, :id => PRJ_ID
354 get :destroy, :id => PRJ_ID
353 assert_response 302
355 assert_response 302
354 @project.reload
356 @project.reload
355 assert_nil @project.repository
357 assert_nil @project.repository
356 end
358 end
357 else
359 else
358 puts "Subversion test repository NOT FOUND. Skipping functional tests !!!"
360 puts "Subversion test repository NOT FOUND. Skipping functional tests !!!"
359 def test_fake; assert true end
361 def test_fake; assert true end
360 end
362 end
361 end
363 end
General Comments 0
You need to be logged in to leave comments. Login now