annotate .svn/pristine/7a/7a59e0de6fb3a65fd73a1071a5762041233e7537.svn-base @ 1628:9c5f8e24dadc live tip

Quieten this cron script
author Chris Cannam
date Tue, 25 Aug 2020 11:38:49 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 # Redmine - project management software
Chris@909 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
Chris@909 3 #
Chris@909 4 # This program is free software; you can redistribute it and/or
Chris@909 5 # modify it under the terms of the GNU General Public License
Chris@909 6 # as published by the Free Software Foundation; either version 2
Chris@909 7 # of the License, or (at your option) any later version.
Chris@909 8 #
Chris@909 9 # This program is distributed in the hope that it will be useful,
Chris@909 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@909 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@909 12 # GNU General Public License for more details.
Chris@909 13 #
Chris@909 14 # You should have received a copy of the GNU General Public License
Chris@909 15 # along with this program; if not, write to the Free Software
Chris@909 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@909 17
Chris@909 18 require File.expand_path('../../test_helper', __FILE__)
Chris@909 19 require 'repositories_controller'
Chris@909 20
Chris@909 21 # Re-raise errors caught by the controller.
Chris@909 22 class RepositoriesController; def rescue_action(e) raise e end; end
Chris@909 23
Chris@909 24 class RepositoriesGitControllerTest < ActionController::TestCase
Chris@909 25 fixtures :projects, :users, :roles, :members, :member_roles,
Chris@909 26 :repositories, :enabled_modules
Chris@909 27
Chris@909 28 REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
Chris@909 29 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
Chris@909 30 PRJ_ID = 3
Chris@909 31 CHAR_1_HEX = "\xc3\x9c"
Chris@909 32 NUM_REV = 21
Chris@909 33
Chris@909 34 ## Git, Mercurial and CVS path encodings are binary.
Chris@909 35 ## Subversion supports URL encoding for path.
Chris@909 36 ## Redmine Mercurial adapter and extension use URL encoding.
Chris@909 37 ## Git accepts only binary path in command line parameter.
Chris@909 38 ## So, there is no way to use binary command line parameter in JRuby.
Chris@909 39 JRUBY_SKIP = (RUBY_PLATFORM == 'java')
Chris@909 40 JRUBY_SKIP_STR = "TODO: This test fails in JRuby"
Chris@909 41
Chris@909 42 def setup
Chris@909 43 @ruby19_non_utf8_pass =
Chris@909 44 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
Chris@909 45
Chris@909 46 @controller = RepositoriesController.new
Chris@909 47 @request = ActionController::TestRequest.new
Chris@909 48 @response = ActionController::TestResponse.new
Chris@909 49 User.current = nil
Chris@909 50 @project = Project.find(PRJ_ID)
Chris@909 51 @repository = Repository::Git.create(
Chris@909 52 :project => @project,
Chris@909 53 :url => REPOSITORY_PATH,
Chris@909 54 :path_encoding => 'ISO-8859-1'
Chris@909 55 )
Chris@909 56 assert @repository
Chris@909 57 @char_1 = CHAR_1_HEX.dup
Chris@909 58 if @char_1.respond_to?(:force_encoding)
Chris@909 59 @char_1.force_encoding('UTF-8')
Chris@909 60 end
Chris@909 61
Chris@909 62 Setting.default_language = 'en'
Chris@909 63 end
Chris@909 64
Chris@909 65 if File.directory?(REPOSITORY_PATH)
Chris@909 66 def test_browse_root
Chris@909 67 assert_equal 0, @repository.changesets.count
Chris@909 68 @repository.fetch_changesets
Chris@909 69 @project.reload
Chris@909 70 assert_equal NUM_REV, @repository.changesets.count
Chris@909 71
Chris@909 72 get :show, :id => PRJ_ID
Chris@909 73 assert_response :success
Chris@909 74 assert_template 'show'
Chris@909 75 assert_not_nil assigns(:entries)
Chris@909 76 assert_equal 9, assigns(:entries).size
Chris@909 77 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
Chris@909 78 assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
Chris@909 79 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
Chris@909 80 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
Chris@909 81 assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
Chris@909 82 assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'}
Chris@909 83 assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
Chris@909 84 assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
Chris@909 85 assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'}
Chris@909 86 assert_not_nil assigns(:changesets)
Chris@909 87 assert assigns(:changesets).size > 0
Chris@909 88 end
Chris@909 89
Chris@909 90 def test_browse_branch
Chris@909 91 assert_equal 0, @repository.changesets.count
Chris@909 92 @repository.fetch_changesets
Chris@909 93 @project.reload
Chris@909 94 assert_equal NUM_REV, @repository.changesets.count
Chris@909 95 get :show, :id => PRJ_ID, :rev => 'test_branch'
Chris@909 96 assert_response :success
Chris@909 97 assert_template 'show'
Chris@909 98 assert_not_nil assigns(:entries)
Chris@909 99 assert_equal 4, assigns(:entries).size
Chris@909 100 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
Chris@909 101 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
Chris@909 102 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
Chris@909 103 assert assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'}
Chris@909 104 assert_not_nil assigns(:changesets)
Chris@909 105 assert assigns(:changesets).size > 0
Chris@909 106 end
Chris@909 107
Chris@909 108 def test_browse_tag
Chris@909 109 assert_equal 0, @repository.changesets.count
Chris@909 110 @repository.fetch_changesets
Chris@909 111 @project.reload
Chris@909 112 assert_equal NUM_REV, @repository.changesets.count
Chris@909 113 [
Chris@909 114 "tag00.lightweight",
Chris@909 115 "tag01.annotated",
Chris@909 116 ].each do |t1|
Chris@909 117 get :show, :id => PRJ_ID, :rev => t1
Chris@909 118 assert_response :success
Chris@909 119 assert_template 'show'
Chris@909 120 assert_not_nil assigns(:entries)
Chris@909 121 assert assigns(:entries).size > 0
Chris@909 122 assert_not_nil assigns(:changesets)
Chris@909 123 assert assigns(:changesets).size > 0
Chris@909 124 end
Chris@909 125 end
Chris@909 126
Chris@909 127 def test_browse_directory
Chris@909 128 assert_equal 0, @repository.changesets.count
Chris@909 129 @repository.fetch_changesets
Chris@909 130 @project.reload
Chris@909 131 assert_equal NUM_REV, @repository.changesets.count
Chris@909 132 get :show, :id => PRJ_ID, :path => ['images']
Chris@909 133 assert_response :success
Chris@909 134 assert_template 'show'
Chris@909 135 assert_not_nil assigns(:entries)
Chris@909 136 assert_equal ['edit.png'], assigns(:entries).collect(&:name)
Chris@909 137 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
Chris@909 138 assert_not_nil entry
Chris@909 139 assert_equal 'file', entry.kind
Chris@909 140 assert_equal 'images/edit.png', entry.path
Chris@909 141 assert_not_nil assigns(:changesets)
Chris@909 142 assert assigns(:changesets).size > 0
Chris@909 143 end
Chris@909 144
Chris@909 145 def test_browse_at_given_revision
Chris@909 146 assert_equal 0, @repository.changesets.count
Chris@909 147 @repository.fetch_changesets
Chris@909 148 @project.reload
Chris@909 149 assert_equal NUM_REV, @repository.changesets.count
Chris@909 150 get :show, :id => PRJ_ID, :path => ['images'],
Chris@909 151 :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
Chris@909 152 assert_response :success
Chris@909 153 assert_template 'show'
Chris@909 154 assert_not_nil assigns(:entries)
Chris@909 155 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
Chris@909 156 assert_not_nil assigns(:changesets)
Chris@909 157 assert assigns(:changesets).size > 0
Chris@909 158 end
Chris@909 159
Chris@909 160 def test_changes
Chris@909 161 get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
Chris@909 162 assert_response :success
Chris@909 163 assert_template 'changes'
Chris@909 164 assert_tag :tag => 'h2', :content => 'edit.png'
Chris@909 165 end
Chris@909 166
Chris@909 167 def test_entry_show
Chris@909 168 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
Chris@909 169 assert_response :success
Chris@909 170 assert_template 'entry'
Chris@909 171 # Line 19
Chris@909 172 assert_tag :tag => 'th',
Chris@909 173 :content => '11',
Chris@909 174 :attributes => { :class => 'line-num' },
Chris@909 175 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
Chris@909 176 end
Chris@909 177
Chris@909 178 def test_entry_show_latin_1
Chris@909 179 if @ruby19_non_utf8_pass
Chris@909 180 puts_ruby19_non_utf8_pass()
Chris@909 181 elsif JRUBY_SKIP
Chris@909 182 puts JRUBY_SKIP_STR
Chris@909 183 else
Chris@909 184 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
Chris@909 185 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
Chris@909 186 get :entry, :id => PRJ_ID,
Chris@909 187 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
Chris@909 188 assert_response :success
Chris@909 189 assert_template 'entry'
Chris@909 190 assert_tag :tag => 'th',
Chris@909 191 :content => '1',
Chris@909 192 :attributes => { :class => 'line-num' },
Chris@909 193 :sibling => { :tag => 'td',
Chris@909 194 :content => /test-#{@char_1}.txt/ }
Chris@909 195 end
Chris@909 196 end
Chris@909 197 end
Chris@909 198 end
Chris@909 199
Chris@909 200 def test_entry_download
Chris@909 201 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'],
Chris@909 202 :format => 'raw'
Chris@909 203 assert_response :success
Chris@909 204 # File content
Chris@909 205 assert @response.body.include?('WITHOUT ANY WARRANTY')
Chris@909 206 end
Chris@909 207
Chris@909 208 def test_directory_entry
Chris@909 209 get :entry, :id => PRJ_ID, :path => ['sources']
Chris@909 210 assert_response :success
Chris@909 211 assert_template 'show'
Chris@909 212 assert_not_nil assigns(:entry)
Chris@909 213 assert_equal 'sources', assigns(:entry).name
Chris@909 214 end
Chris@909 215
Chris@909 216 def test_diff
Chris@909 217 assert_equal 0, @repository.changesets.count
Chris@909 218 @repository.fetch_changesets
Chris@909 219 @project.reload
Chris@909 220 assert_equal NUM_REV, @repository.changesets.count
Chris@909 221 # Full diff of changeset 2f9c0091
Chris@909 222 ['inline', 'sbs'].each do |dt|
Chris@909 223 get :diff,
Chris@909 224 :id => PRJ_ID,
Chris@909 225 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
Chris@909 226 :type => dt
Chris@909 227 assert_response :success
Chris@909 228 assert_template 'diff'
Chris@909 229 # Line 22 removed
Chris@909 230 assert_tag :tag => 'th',
Chris@909 231 :content => /22/,
Chris@909 232 :sibling => { :tag => 'td',
Chris@909 233 :attributes => { :class => /diff_out/ },
Chris@909 234 :content => /def remove/ }
Chris@909 235 assert_tag :tag => 'h2', :content => /2f9c0091/
Chris@909 236 end
Chris@909 237 end
Chris@909 238
Chris@909 239 def test_diff_truncated
Chris@909 240 assert_equal 0, @repository.changesets.count
Chris@909 241 @repository.fetch_changesets
Chris@909 242 @project.reload
Chris@909 243 assert_equal NUM_REV, @repository.changesets.count
Chris@909 244 Setting.diff_max_lines_displayed = 5
Chris@909 245
Chris@909 246 # Truncated diff of changeset 2f9c0091
Chris@909 247 with_cache do
Chris@909 248 get :diff, :id => PRJ_ID, :type => 'inline',
Chris@909 249 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
Chris@909 250 assert_response :success
Chris@909 251 assert @response.body.include?("... This diff was truncated")
Chris@909 252
Chris@909 253 Setting.default_language = 'fr'
Chris@909 254 get :diff, :id => PRJ_ID, :type => 'inline',
Chris@909 255 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
Chris@909 256 assert_response :success
Chris@909 257 assert ! @response.body.include?("... This diff was truncated")
Chris@909 258 assert @response.body.include?("... Ce diff")
Chris@909 259 end
Chris@909 260 end
Chris@909 261
Chris@909 262 def test_diff_two_revs
Chris@909 263 assert_equal 0, @repository.changesets.count
Chris@909 264 @repository.fetch_changesets
Chris@909 265 @project.reload
Chris@909 266 assert_equal NUM_REV, @repository.changesets.count
Chris@909 267 ['inline', 'sbs'].each do |dt|
Chris@909 268 get :diff,
Chris@909 269 :id => PRJ_ID,
Chris@909 270 :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
Chris@909 271 :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
Chris@909 272 :type => dt
Chris@909 273 assert_response :success
Chris@909 274 assert_template 'diff'
Chris@909 275 diff = assigns(:diff)
Chris@909 276 assert_not_nil diff
Chris@909 277 assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
Chris@909 278 end
Chris@909 279 end
Chris@909 280
Chris@909 281 def test_diff_latin_1
Chris@909 282 if @ruby19_non_utf8_pass
Chris@909 283 puts_ruby19_non_utf8_pass()
Chris@909 284 else
Chris@909 285 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
Chris@909 286 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
Chris@909 287 ['inline', 'sbs'].each do |dt|
Chris@909 288 get :diff, :id => PRJ_ID, :rev => r1, :type => dt
Chris@909 289 assert_response :success
Chris@909 290 assert_template 'diff'
Chris@909 291 assert_tag :tag => 'thead',
Chris@909 292 :descendant => {
Chris@909 293 :tag => 'th',
Chris@909 294 :attributes => { :class => 'filename' } ,
Chris@909 295 :content => /latin-1-dir\/test-#{@char_1}.txt/ ,
Chris@909 296 },
Chris@909 297 :sibling => {
Chris@909 298 :tag => 'tbody',
Chris@909 299 :descendant => {
Chris@909 300 :tag => 'td',
Chris@909 301 :attributes => { :class => /diff_in/ },
Chris@909 302 :content => /test-#{@char_1}.txt/
Chris@909 303 }
Chris@909 304 }
Chris@909 305 end
Chris@909 306 end
Chris@909 307 end
Chris@909 308 end
Chris@909 309 end
Chris@909 310
Chris@909 311 def test_save_diff_type
Chris@909 312 @request.session[:user_id] = 1 # admin
Chris@909 313 user = User.find(1)
Chris@909 314 get :diff,
Chris@909 315 :id => PRJ_ID,
Chris@909 316 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
Chris@909 317 assert_response :success
Chris@909 318 assert_template 'diff'
Chris@909 319 user.reload
Chris@909 320 assert_equal "inline", user.pref[:diff_type]
Chris@909 321 get :diff,
Chris@909 322 :id => PRJ_ID,
Chris@909 323 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
Chris@909 324 :type => 'sbs'
Chris@909 325 assert_response :success
Chris@909 326 assert_template 'diff'
Chris@909 327 user.reload
Chris@909 328 assert_equal "sbs", user.pref[:diff_type]
Chris@909 329 end
Chris@909 330
Chris@909 331 def test_annotate
Chris@909 332 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
Chris@909 333 assert_response :success
Chris@909 334 assert_template 'annotate'
Chris@909 335 # Line 24, changeset 2f9c0091
Chris@909 336 assert_tag :tag => 'th', :content => '24',
Chris@909 337 :sibling => {
Chris@909 338 :tag => 'td',
Chris@909 339 :child => {
Chris@909 340 :tag => 'a',
Chris@909 341 :content => /2f9c0091/
Chris@909 342 }
Chris@909 343 }
Chris@909 344 assert_tag :tag => 'th', :content => '24',
Chris@909 345 :sibling => { :tag => 'td', :content => /jsmith/ }
Chris@909 346 assert_tag :tag => 'th', :content => '24',
Chris@909 347 :sibling => {
Chris@909 348 :tag => 'td',
Chris@909 349 :child => {
Chris@909 350 :tag => 'a',
Chris@909 351 :content => /2f9c0091/
Chris@909 352 }
Chris@909 353 }
Chris@909 354 assert_tag :tag => 'th', :content => '24',
Chris@909 355 :sibling => { :tag => 'td', :content => /watcher =/ }
Chris@909 356 end
Chris@909 357
Chris@909 358 def test_annotate_at_given_revision
Chris@909 359 assert_equal 0, @repository.changesets.count
Chris@909 360 @repository.fetch_changesets
Chris@909 361 @project.reload
Chris@909 362 assert_equal NUM_REV, @repository.changesets.count
Chris@909 363 get :annotate, :id => PRJ_ID, :rev => 'deff7',
Chris@909 364 :path => ['sources', 'watchers_controller.rb']
Chris@909 365 assert_response :success
Chris@909 366 assert_template 'annotate'
Chris@909 367 assert_tag :tag => 'h2', :content => /@ deff712f/
Chris@909 368 end
Chris@909 369
Chris@909 370 def test_annotate_binary_file
Chris@909 371 get :annotate, :id => PRJ_ID, :path => ['images', 'edit.png']
Chris@909 372 assert_response 500
Chris@909 373 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
Chris@909 374 :content => /cannot be annotated/
Chris@909 375 end
Chris@909 376
Chris@909 377 def test_annotate_error_when_too_big
Chris@909 378 with_settings :file_max_size_displayed => 1 do
Chris@909 379 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :rev => 'deff712f'
Chris@909 380 assert_response 500
Chris@909 381 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
Chris@909 382 :content => /exceeds the maximum text file size/
Chris@909 383
Chris@909 384 get :annotate, :id => PRJ_ID, :path => ['README'], :rev => '7234cb2'
Chris@909 385 assert_response :success
Chris@909 386 assert_template 'annotate'
Chris@909 387 end
Chris@909 388 end
Chris@909 389
Chris@909 390 def test_annotate_latin_1
Chris@909 391 if @ruby19_non_utf8_pass
Chris@909 392 puts_ruby19_non_utf8_pass()
Chris@909 393 elsif JRUBY_SKIP
Chris@909 394 puts JRUBY_SKIP_STR
Chris@909 395 else
Chris@909 396 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
Chris@909 397 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
Chris@909 398 get :annotate, :id => PRJ_ID,
Chris@909 399 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
Chris@909 400 assert_tag :tag => 'th',
Chris@909 401 :content => '1',
Chris@909 402 :attributes => { :class => 'line-num' },
Chris@909 403 :sibling => { :tag => 'td',
Chris@909 404 :content => /test-#{@char_1}.txt/ }
Chris@909 405 end
Chris@909 406 end
Chris@909 407 end
Chris@909 408 end
Chris@909 409
Chris@909 410 def test_revision
Chris@909 411 assert_equal 0, @repository.changesets.count
Chris@909 412 @repository.fetch_changesets
Chris@909 413 @project.reload
Chris@909 414 assert_equal NUM_REV, @repository.changesets.count
Chris@909 415 ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
Chris@909 416 get :revision, :id => PRJ_ID, :rev => r
Chris@909 417 assert_response :success
Chris@909 418 assert_template 'revision'
Chris@909 419 end
Chris@909 420 end
Chris@909 421
Chris@909 422 def test_empty_revision
Chris@909 423 assert_equal 0, @repository.changesets.count
Chris@909 424 @repository.fetch_changesets
Chris@909 425 @project.reload
Chris@909 426 assert_equal NUM_REV, @repository.changesets.count
Chris@909 427 ['', ' ', nil].each do |r|
Chris@909 428 get :revision, :id => PRJ_ID, :rev => r
Chris@909 429 assert_response 404
Chris@909 430 assert_error_tag :content => /was not found/
Chris@909 431 end
Chris@909 432 end
Chris@909 433
Chris@909 434 def test_destroy_valid_repository
Chris@909 435 @request.session[:user_id] = 1 # admin
Chris@909 436 assert_equal 0, @repository.changesets.count
Chris@909 437 @repository.fetch_changesets
Chris@909 438 @project.reload
Chris@909 439 assert_equal NUM_REV, @repository.changesets.count
Chris@909 440
Chris@909 441 get :destroy, :id => PRJ_ID
Chris@909 442 assert_response 302
Chris@909 443 @project.reload
Chris@909 444 assert_nil @project.repository
Chris@909 445 end
Chris@909 446
Chris@909 447 def test_destroy_invalid_repository
Chris@909 448 @request.session[:user_id] = 1 # admin
Chris@909 449 assert_equal 0, @repository.changesets.count
Chris@909 450 @repository.fetch_changesets
Chris@909 451 @project.reload
Chris@909 452 assert_equal NUM_REV, @repository.changesets.count
Chris@909 453
Chris@909 454 get :destroy, :id => PRJ_ID
Chris@909 455 assert_response 302
Chris@909 456 @project.reload
Chris@909 457 assert_nil @project.repository
Chris@909 458
Chris@909 459 @repository = Repository::Git.create(
Chris@909 460 :project => @project,
Chris@909 461 :url => "/invalid",
Chris@909 462 :path_encoding => 'ISO-8859-1'
Chris@909 463 )
Chris@909 464 assert @repository
Chris@909 465 @repository.fetch_changesets
Chris@909 466 @repository.reload
Chris@909 467 assert_equal 0, @repository.changesets.count
Chris@909 468
Chris@909 469 get :destroy, :id => PRJ_ID
Chris@909 470 assert_response 302
Chris@909 471 @project.reload
Chris@909 472 assert_nil @project.repository
Chris@909 473 end
Chris@909 474
Chris@909 475 private
Chris@909 476
Chris@909 477 def puts_ruby19_non_utf8_pass
Chris@909 478 puts "TODO: This test fails in Ruby 1.9 " +
Chris@909 479 "and Encoding.default_external is not UTF-8. " +
Chris@909 480 "Current value is '#{Encoding.default_external.to_s}'"
Chris@909 481 end
Chris@909 482 else
Chris@909 483 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
Chris@909 484 def test_fake; assert true end
Chris@909 485 end
Chris@909 486
Chris@909 487 private
Chris@909 488 def with_cache(&block)
Chris@909 489 before = ActionController::Base.perform_caching
Chris@909 490 ActionController::Base.perform_caching = true
Chris@909 491 block.call
Chris@909 492 ActionController::Base.perform_caching = before
Chris@909 493 end
Chris@909 494 end