Mercurial > hg > soundsoftware-site
comparison test/functional/repositories_mercurial_controller_test.rb @ 1526:404aa68d4227
Merge from live branch
author | Chris Cannam |
---|---|
date | Thu, 11 Sep 2014 12:46:20 +0100 |
parents | fb9a13467253 |
children |
comparison
equal
deleted
inserted
replaced
1493:a5f2bdf3b486 | 1526:404aa68d4227 |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2014 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. |
24 :repositories, :enabled_modules | 24 :repositories, :enabled_modules |
25 | 25 |
26 REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s | 26 REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s |
27 CHAR_1_HEX = "\xc3\x9c" | 27 CHAR_1_HEX = "\xc3\x9c" |
28 PRJ_ID = 3 | 28 PRJ_ID = 3 |
29 NUM_REV = 32 | 29 NUM_REV = 34 |
30 | 30 |
31 ruby19_non_utf8_pass = | 31 ruby19_non_utf8_pass = |
32 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8') | 32 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8') |
33 | 33 |
34 def setup | 34 def setup |
430 get :annotate, :id => PRJ_ID, | 430 get :annotate, :id => PRJ_ID, |
431 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param], | 431 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param], |
432 :rev => r1 | 432 :rev => r1 |
433 assert_response :success | 433 assert_response :success |
434 assert_template 'annotate' | 434 assert_template 'annotate' |
435 assert_tag :tag => 'th', | 435 assert_select "th.line-num", :text => '1' do |
436 :content => '1', | 436 assert_select "+ td.revision" do |
437 :attributes => { :class => 'line-num' }, | 437 assert_select "a", :text => '20:709858aafd1b' |
438 :sibling => | 438 assert_select "+ td.author", :text => "jsmith" do |
439 { | 439 assert_select "+ td", |
440 :tag => 'td', | 440 :text => "Mercurial is a distributed version control system." |
441 :attributes => { :class => 'revision' }, | 441 end |
442 :child => { :tag => 'a', :content => '20:709858aafd1b' } | 442 end |
443 } | 443 end |
444 assert_tag :tag => 'th', | |
445 :content => '1', | |
446 :attributes => { :class => 'line-num' }, | |
447 :sibling => | |
448 { | |
449 :tag => 'td' , | |
450 :content => 'jsmith' , | |
451 :attributes => { :class => 'author' }, | |
452 } | |
453 assert_tag :tag => 'th', | |
454 :content => '1', | |
455 :attributes => { :class => 'line-num' }, | |
456 :sibling => { :tag => 'td', | |
457 :content => /Mercurial is a distributed version control system/ } | |
458 | |
459 end | 444 end |
460 end | 445 end |
461 | 446 |
462 def test_annotate_latin_1_contents | 447 def test_annotate_latin_1_contents |
463 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do | 448 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do |
472 :content => /test-#{@char_1}.txt/ } | 457 :content => /test-#{@char_1}.txt/ } |
473 end | 458 end |
474 end | 459 end |
475 end | 460 end |
476 | 461 |
462 def test_revision | |
463 assert_equal 0, @repository.changesets.count | |
464 @repository.fetch_changesets | |
465 @project.reload | |
466 assert_equal NUM_REV, @repository.changesets.count | |
467 ['1', '9d5b5b', '9d5b5b004199'].each do |r| | |
468 with_settings :default_language => "en" do | |
469 get :revision, :id => PRJ_ID, :rev => r | |
470 assert_response :success | |
471 assert_template 'revision' | |
472 assert_select 'title', | |
473 :text => 'Revision 1:9d5b5b004199 - Added 2 files and modified one. - eCookbook Subproject 1 - Redmine' | |
474 end | |
475 end | |
476 end | |
477 | |
477 def test_empty_revision | 478 def test_empty_revision |
478 assert_equal 0, @repository.changesets.count | 479 assert_equal 0, @repository.changesets.count |
479 @repository.fetch_changesets | 480 @repository.fetch_changesets |
480 @project.reload | 481 @project.reload |
481 assert_equal NUM_REV, @repository.changesets.count | 482 assert_equal NUM_REV, @repository.changesets.count |