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