annotate test/functional/repositories_git_controller_test.rb @ 1082:997f6d7738f7 bug_531

In repo controller entry action, show the page for the file even if it's binary (so user still has access to history etc links). This makes it possible to use the entry action as the default when a file is clicked on
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 22 Nov 2012 18:04:17 +0000
parents cbb26bc654de
children 433d4f72a19b
rev   line source
Chris@441 1 # Redmine - project management software
Chris@441 2 # Copyright (C) 2006-2011 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 require 'repositories_controller'
Chris@0 20
Chris@0 21 # Re-raise errors caught by the controller.
Chris@0 22 class RepositoriesController; def rescue_action(e) raise e end; end
Chris@0 23
Chris@0 24 class RepositoriesGitControllerTest < ActionController::TestCase
Chris@909 25 fixtures :projects, :users, :roles, :members, :member_roles,
Chris@909 26 :repositories, :enabled_modules
Chris@0 27
Chris@909 28 REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
Chris@0 29 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
Chris@441 30 PRJ_ID = 3
Chris@441 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@0 41
Chris@0 42 def setup
Chris@441 43 @ruby19_non_utf8_pass =
Chris@441 44 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
Chris@441 45
Chris@0 46 @controller = RepositoriesController.new
Chris@0 47 @request = ActionController::TestRequest.new
Chris@0 48 @response = ActionController::TestResponse.new
Chris@0 49 User.current = nil
Chris@909 50 @project = Project.find(PRJ_ID)
Chris@441 51 @repository = Repository::Git.create(
Chris@909 52 :project => @project,
Chris@909 53 :url => REPOSITORY_PATH,
Chris@441 54 :path_encoding => 'ISO-8859-1'
Chris@441 55 )
Chris@119 56 assert @repository
Chris@441 57 @char_1 = CHAR_1_HEX.dup
Chris@441 58 if @char_1.respond_to?(:force_encoding)
Chris@441 59 @char_1.force_encoding('UTF-8')
Chris@441 60 end
Chris@507 61
Chris@507 62 Setting.default_language = 'en'
Chris@0 63 end
Chris@119 64
Chris@0 65 if File.directory?(REPOSITORY_PATH)
Chris@0 66 def test_browse_root
Chris@909 67 assert_equal 0, @repository.changesets.count
Chris@441 68 @repository.fetch_changesets
Chris@909 69 @project.reload
Chris@909 70 assert_equal NUM_REV, @repository.changesets.count
Chris@909 71
Chris@441 72 get :show, :id => PRJ_ID
Chris@0 73 assert_response :success
Chris@0 74 assert_template 'show'
Chris@0 75 assert_not_nil assigns(:entries)
chris@37 76 assert_equal 9, assigns(:entries).size
Chris@0 77 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
Chris@0 78 assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
Chris@0 79 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
Chris@0 80 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
Chris@0 81 assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
Chris@0 82 assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'}
Chris@0 83 assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
chris@37 84 assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
chris@37 85 assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'}
Chris@441 86 assert_not_nil assigns(:changesets)
Chris@909 87 assert assigns(:changesets).size > 0
Chris@0 88 end
Chris@0 89
Chris@0 90 def test_browse_branch
Chris@909 91 assert_equal 0, @repository.changesets.count
Chris@441 92 @repository.fetch_changesets
Chris@909 93 @project.reload
Chris@909 94 assert_equal NUM_REV, @repository.changesets.count
Chris@441 95 get :show, :id => PRJ_ID, :rev => 'test_branch'
Chris@0 96 assert_response :success
Chris@0 97 assert_template 'show'
Chris@0 98 assert_not_nil assigns(:entries)
Chris@0 99 assert_equal 4, assigns(:entries).size
Chris@0 100 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
Chris@0 101 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
Chris@0 102 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
Chris@0 103 assert assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'}
Chris@441 104 assert_not_nil assigns(:changesets)
Chris@909 105 assert assigns(:changesets).size > 0
Chris@441 106 end
Chris@441 107
Chris@441 108 def test_browse_tag
Chris@909 109 assert_equal 0, @repository.changesets.count
Chris@441 110 @repository.fetch_changesets
Chris@909 111 @project.reload
Chris@909 112 assert_equal NUM_REV, @repository.changesets.count
Chris@441 113 [
Chris@441 114 "tag00.lightweight",
Chris@441 115 "tag01.annotated",
Chris@441 116 ].each do |t1|
Chris@441 117 get :show, :id => PRJ_ID, :rev => t1
Chris@441 118 assert_response :success
Chris@441 119 assert_template 'show'
Chris@441 120 assert_not_nil assigns(:entries)
Chris@909 121 assert assigns(:entries).size > 0
Chris@441 122 assert_not_nil assigns(:changesets)
Chris@909 123 assert assigns(:changesets).size > 0
Chris@441 124 end
Chris@0 125 end
Chris@0 126
Chris@0 127 def test_browse_directory
Chris@909 128 assert_equal 0, @repository.changesets.count
Chris@441 129 @repository.fetch_changesets
Chris@909 130 @project.reload
Chris@909 131 assert_equal NUM_REV, @repository.changesets.count
Chris@441 132 get :show, :id => PRJ_ID, :path => ['images']
Chris@0 133 assert_response :success
Chris@0 134 assert_template 'show'
Chris@0 135 assert_not_nil assigns(:entries)
Chris@0 136 assert_equal ['edit.png'], assigns(:entries).collect(&:name)
Chris@0 137 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
Chris@0 138 assert_not_nil entry
Chris@0 139 assert_equal 'file', entry.kind
Chris@0 140 assert_equal 'images/edit.png', entry.path
Chris@441 141 assert_not_nil assigns(:changesets)
Chris@909 142 assert assigns(:changesets).size > 0
Chris@0 143 end
Chris@441 144
Chris@0 145 def test_browse_at_given_revision
Chris@909 146 assert_equal 0, @repository.changesets.count
Chris@441 147 @repository.fetch_changesets
Chris@909 148 @project.reload
Chris@909 149 assert_equal NUM_REV, @repository.changesets.count
Chris@441 150 get :show, :id => PRJ_ID, :path => ['images'],
Chris@441 151 :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
Chris@0 152 assert_response :success
Chris@0 153 assert_template 'show'
Chris@0 154 assert_not_nil assigns(:entries)
Chris@0 155 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
Chris@441 156 assert_not_nil assigns(:changesets)
Chris@909 157 assert assigns(:changesets).size > 0
Chris@0 158 end
Chris@0 159
Chris@0 160 def test_changes
Chris@441 161 get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
Chris@0 162 assert_response :success
Chris@0 163 assert_template 'changes'
Chris@0 164 assert_tag :tag => 'h2', :content => 'edit.png'
Chris@0 165 end
Chris@441 166
Chris@0 167 def test_entry_show
Chris@441 168 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
Chris@0 169 assert_response :success
Chris@0 170 assert_template 'entry'
Chris@0 171 # Line 19
Chris@0 172 assert_tag :tag => 'th',
Chris@441 173 :content => '11',
Chris@441 174 :attributes => { :class => 'line-num' },
Chris@0 175 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
Chris@0 176 end
Chris@441 177
Chris@441 178 def test_entry_show_latin_1
Chris@441 179 if @ruby19_non_utf8_pass
Chris@441 180 puts_ruby19_non_utf8_pass()
Chris@909 181 elsif JRUBY_SKIP
Chris@909 182 puts JRUBY_SKIP_STR
Chris@441 183 else
Chris@441 184 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
Chris@441 185 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
Chris@441 186 get :entry, :id => PRJ_ID,
Chris@441 187 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
Chris@441 188 assert_response :success
Chris@441 189 assert_template 'entry'
Chris@441 190 assert_tag :tag => 'th',
Chris@441 191 :content => '1',
Chris@441 192 :attributes => { :class => 'line-num' },
Chris@441 193 :sibling => { :tag => 'td',
Chris@441 194 :content => /test-#{@char_1}.txt/ }
Chris@441 195 end
Chris@441 196 end
Chris@441 197 end
Chris@441 198 end
Chris@441 199
Chris@0 200 def test_entry_download
Chris@441 201 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'],
Chris@441 202 :format => 'raw'
Chris@0 203 assert_response :success
Chris@0 204 # File content
Chris@0 205 assert @response.body.include?('WITHOUT ANY WARRANTY')
Chris@0 206 end
Chris@441 207
Chris@0 208 def test_directory_entry
Chris@441 209 get :entry, :id => PRJ_ID, :path => ['sources']
Chris@0 210 assert_response :success
Chris@0 211 assert_template 'show'
Chris@0 212 assert_not_nil assigns(:entry)
Chris@0 213 assert_equal 'sources', assigns(:entry).name
Chris@0 214 end
Chris@119 215
Chris@0 216 def test_diff
Chris@909 217 assert_equal 0, @repository.changesets.count
Chris@119 218 @repository.fetch_changesets
Chris@909 219 @project.reload
Chris@909 220 assert_equal NUM_REV, @repository.changesets.count
Chris@0 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@119 237 end
Chris@119 238
Chris@507 239 def test_diff_truncated
Chris@909 240 assert_equal 0, @repository.changesets.count
Chris@507 241 @repository.fetch_changesets
Chris@909 242 @project.reload
Chris@909 243 assert_equal NUM_REV, @repository.changesets.count
Chris@507 244 Setting.diff_max_lines_displayed = 5
Chris@507 245
Chris@507 246 # Truncated diff of changeset 2f9c0091
Chris@507 247 with_cache do
Chris@507 248 get :diff, :id => PRJ_ID, :type => 'inline',
Chris@507 249 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
Chris@507 250 assert_response :success
Chris@507 251 assert @response.body.include?("... This diff was truncated")
Chris@507 252
Chris@507 253 Setting.default_language = 'fr'
Chris@507 254 get :diff, :id => PRJ_ID, :type => 'inline',
Chris@507 255 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
Chris@507 256 assert_response :success
Chris@507 257 assert ! @response.body.include?("... This diff was truncated")
Chris@507 258 assert @response.body.include?("... Ce diff")
Chris@507 259 end
Chris@507 260 end
Chris@507 261
Chris@119 262 def test_diff_two_revs
Chris@909 263 assert_equal 0, @repository.changesets.count
Chris@119 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@0 279 end
Chris@0 280
Chris@441 281 def test_diff_latin_1
Chris@441 282 if @ruby19_non_utf8_pass
Chris@441 283 puts_ruby19_non_utf8_pass()
Chris@441 284 else
Chris@441 285 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
Chris@441 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@441 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@441 304 }
Chris@909 305 end
Chris@441 306 end
Chris@441 307 end
Chris@441 308 end
Chris@441 309 end
Chris@441 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@0 331 def test_annotate
Chris@441 332 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
Chris@0 333 assert_response :success
Chris@0 334 assert_template 'annotate'
Chris@909 335 # Line 24, changeset 2f9c0091
Chris@441 336 assert_tag :tag => 'th', :content => '24',
Chris@441 337 :sibling => {
Chris@441 338 :tag => 'td',
Chris@441 339 :child => {
Chris@441 340 :tag => 'a',
Chris@909 341 :content => /2f9c0091/
Chris@441 342 }
Chris@909 343 }
Chris@909 344 assert_tag :tag => 'th', :content => '24',
Chris@441 345 :sibling => { :tag => 'td', :content => /jsmith/ }
Chris@441 346 assert_tag :tag => 'th', :content => '24',
Chris@441 347 :sibling => {
Chris@441 348 :tag => 'td',
Chris@441 349 :child => {
Chris@441 350 :tag => 'a',
Chris@909 351 :content => /2f9c0091/
Chris@441 352 }
Chris@909 353 }
Chris@909 354 assert_tag :tag => 'th', :content => '24',
Chris@0 355 :sibling => { :tag => 'td', :content => /watcher =/ }
Chris@0 356 end
Chris@119 357
Chris@210 358 def test_annotate_at_given_revision
Chris@909 359 assert_equal 0, @repository.changesets.count
Chris@210 360 @repository.fetch_changesets
Chris@909 361 @project.reload
Chris@909 362 assert_equal NUM_REV, @repository.changesets.count
Chris@441 363 get :annotate, :id => PRJ_ID, :rev => 'deff7',
Chris@441 364 :path => ['sources', 'watchers_controller.rb']
Chris@210 365 assert_response :success
Chris@210 366 assert_template 'annotate'
Chris@210 367 assert_tag :tag => 'h2', :content => /@ deff712f/
Chris@210 368 end
Chris@210 369
Chris@0 370 def test_annotate_binary_file
Chris@441 371 get :annotate, :id => PRJ_ID, :path => ['images', 'edit.png']
Chris@0 372 assert_response 500
chris@37 373 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
Chris@441 374 :content => /cannot be annotated/
Chris@441 375 end
Chris@441 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@441 390 def test_annotate_latin_1
Chris@441 391 if @ruby19_non_utf8_pass
Chris@441 392 puts_ruby19_non_utf8_pass()
Chris@909 393 elsif JRUBY_SKIP
Chris@909 394 puts JRUBY_SKIP_STR
Chris@441 395 else
Chris@441 396 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
Chris@441 397 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
Chris@441 398 get :annotate, :id => PRJ_ID,
Chris@441 399 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
Chris@441 400 assert_tag :tag => 'th',
Chris@441 401 :content => '1',
Chris@441 402 :attributes => { :class => 'line-num' },
Chris@441 403 :sibling => { :tag => 'td',
Chris@441 404 :content => /test-#{@char_1}.txt/ }
Chris@441 405 end
Chris@441 406 end
Chris@441 407 end
Chris@0 408 end
Chris@119 409
Chris@119 410 def test_revision
Chris@909 411 assert_equal 0, @repository.changesets.count
Chris@119 412 @repository.fetch_changesets
Chris@909 413 @project.reload
Chris@909 414 assert_equal NUM_REV, @repository.changesets.count
Chris@119 415 ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
Chris@441 416 get :revision, :id => PRJ_ID, :rev => r
Chris@119 417 assert_response :success
Chris@119 418 assert_template 'revision'
Chris@119 419 end
Chris@119 420 end
Chris@119 421
Chris@119 422 def test_empty_revision
Chris@909 423 assert_equal 0, @repository.changesets.count
Chris@119 424 @repository.fetch_changesets
Chris@909 425 @project.reload
Chris@909 426 assert_equal NUM_REV, @repository.changesets.count
Chris@119 427 ['', ' ', nil].each do |r|
Chris@441 428 get :revision, :id => PRJ_ID, :rev => r
Chris@128 429 assert_response 404
Chris@119 430 assert_error_tag :content => /was not found/
Chris@119 431 end
Chris@119 432 end
Chris@441 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@441 475 private
Chris@441 476
Chris@441 477 def puts_ruby19_non_utf8_pass
Chris@441 478 puts "TODO: This test fails in Ruby 1.9 " +
Chris@441 479 "and Encoding.default_external is not UTF-8. " +
Chris@441 480 "Current value is '#{Encoding.default_external.to_s}'"
Chris@441 481 end
Chris@0 482 else
Chris@0 483 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
Chris@0 484 def test_fake; assert true end
Chris@0 485 end
Chris@507 486
Chris@507 487 private
Chris@507 488 def with_cache(&block)
Chris@507 489 before = ActionController::Base.perform_caching
Chris@507 490 ActionController::Base.perform_caching = true
Chris@507 491 block.call
Chris@507 492 ActionController::Base.perform_caching = before
Chris@507 493 end
Chris@0 494 end