Mercurial > hg > soundsoftware-site
comparison test/functional/repositories_mercurial_controller_test.rb @ 507:0c939c159af4 redmine-1.2
Update to Redmine 1.2.1 on 1.2-stable branch (Redmine SVN rev 6270)
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2011 10:32:19 +0100 |
parents | cbce1fd3b1b7 |
children | 851510f1b535 cbb26bc654de |
comparison
equal
deleted
inserted
replaced
441:cbce1fd3b1b7 | 507:0c939c159af4 |
---|---|
36 def setup | 36 def setup |
37 @controller = RepositoriesController.new | 37 @controller = RepositoriesController.new |
38 @request = ActionController::TestRequest.new | 38 @request = ActionController::TestRequest.new |
39 @response = ActionController::TestResponse.new | 39 @response = ActionController::TestResponse.new |
40 User.current = nil | 40 User.current = nil |
41 @project = Project.find(PRJ_ID) | |
41 @repository = Repository::Mercurial.create( | 42 @repository = Repository::Mercurial.create( |
42 :project => Project.find(PRJ_ID), | 43 :project => @project, |
43 :url => REPOSITORY_PATH, | 44 :url => REPOSITORY_PATH, |
44 :path_encoding => 'ISO-8859-1' | 45 :path_encoding => 'ISO-8859-1' |
45 ) | 46 ) |
46 assert @repository | 47 assert @repository |
47 @diff_c_support = true | 48 @diff_c_support = true |
343 :content => '23', | 344 :content => '23', |
344 :attributes => { :class => 'line-num' }, | 345 :attributes => { :class => 'line-num' }, |
345 :sibling => { :tag => 'td', :content => /watcher =/ } | 346 :sibling => { :tag => 'td', :content => /watcher =/ } |
346 end | 347 end |
347 | 348 |
349 def test_annotate_not_in_tip | |
350 @repository.fetch_changesets | |
351 @repository.reload | |
352 assert @repository.changesets.size > 0 | |
353 | |
354 get :annotate, :id => PRJ_ID, | |
355 :path => ['sources', 'welcome_controller.rb'] | |
356 assert_response 404 | |
357 assert_error_tag :content => /was not found/ | |
358 end | |
359 | |
348 def test_annotate_at_given_revision | 360 def test_annotate_at_given_revision |
349 @repository.fetch_changesets | 361 @repository.fetch_changesets |
350 @repository.reload | 362 @repository.reload |
351 [2, '400bb8672109', '400', 400].each do |r1| | 363 [2, '400bb8672109', '400', 400].each do |r1| |
352 get :annotate, :id => PRJ_ID, :rev => r1, | 364 get :annotate, :id => PRJ_ID, :rev => r1, |
411 get :revision, :id => PRJ_ID, :rev => r | 423 get :revision, :id => PRJ_ID, :rev => r |
412 assert_response 404 | 424 assert_response 404 |
413 assert_error_tag :content => /was not found/ | 425 assert_error_tag :content => /was not found/ |
414 end | 426 end |
415 end | 427 end |
428 | |
429 def test_destroy_valid_repository | |
430 @request.session[:user_id] = 1 # admin | |
431 @repository.fetch_changesets | |
432 @repository.reload | |
433 assert @repository.changesets.count > 0 | |
434 | |
435 get :destroy, :id => PRJ_ID | |
436 assert_response 302 | |
437 @project.reload | |
438 assert_nil @project.repository | |
439 end | |
440 | |
441 def test_destroy_invalid_repository | |
442 @request.session[:user_id] = 1 # admin | |
443 @repository.fetch_changesets | |
444 @repository.reload | |
445 assert @repository.changesets.count > 0 | |
446 | |
447 get :destroy, :id => PRJ_ID | |
448 assert_response 302 | |
449 @project.reload | |
450 assert_nil @project.repository | |
451 | |
452 @repository = Repository::Mercurial.create( | |
453 :project => Project.find(PRJ_ID), | |
454 :url => "/invalid", | |
455 :path_encoding => 'ISO-8859-1' | |
456 ) | |
457 assert @repository | |
458 @repository.fetch_changesets | |
459 @repository.reload | |
460 assert_equal 0, @repository.changesets.count | |
461 | |
462 get :destroy, :id => PRJ_ID | |
463 assert_response 302 | |
464 @project.reload | |
465 assert_nil @project.repository | |
466 end | |
416 else | 467 else |
417 puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!" | 468 puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!" |
418 def test_fake; assert true end | 469 def test_fake; assert true end |
419 end | 470 end |
420 end | 471 end |