Mercurial > hg > soundsoftware-site
comparison test/functional/repositories_git_controller_test.rb @ 1464:261b3d9a4903 redmine-2.4
Update to Redmine 2.4 branch rev 12663
author | Chris Cannam |
---|---|
date | Tue, 14 Jan 2014 14:37:42 +0000 |
parents | 433d4f72a19b |
children | e248c7af89ec |
comparison
equal
deleted
inserted
replaced
1296:038ba2d95de8 | 1464:261b3d9a4903 |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2013 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. |
25 | 25 |
26 REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s | 26 REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s |
27 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? | 27 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? |
28 PRJ_ID = 3 | 28 PRJ_ID = 3 |
29 CHAR_1_HEX = "\xc3\x9c" | 29 CHAR_1_HEX = "\xc3\x9c" |
30 FELIX_HEX = "Felix Sch\xC3\xA4fer" | |
30 NUM_REV = 28 | 31 NUM_REV = 28 |
31 | 32 |
32 ## Git, Mercurial and CVS path encodings are binary. | 33 ## Git, Mercurial and CVS path encodings are binary. |
33 ## Subversion supports URL encoding for path. | 34 ## Subversion supports URL encoding for path. |
34 ## Redmine Mercurial adapter and extension use URL encoding. | 35 ## Redmine Mercurial adapter and extension use URL encoding. |
48 :url => REPOSITORY_PATH, | 49 :url => REPOSITORY_PATH, |
49 :path_encoding => 'ISO-8859-1' | 50 :path_encoding => 'ISO-8859-1' |
50 ) | 51 ) |
51 assert @repository | 52 assert @repository |
52 @char_1 = CHAR_1_HEX.dup | 53 @char_1 = CHAR_1_HEX.dup |
54 @felix_utf8 = FELIX_HEX.dup | |
53 if @char_1.respond_to?(:force_encoding) | 55 if @char_1.respond_to?(:force_encoding) |
54 @char_1.force_encoding('UTF-8') | 56 @char_1.force_encoding('UTF-8') |
57 @felix_utf8.force_encoding('UTF-8') | |
55 end | 58 end |
56 end | 59 end |
57 | 60 |
58 def test_create_and_update | 61 def test_create_and_update |
59 @request.session[:user_id] = 1 | 62 @request.session[:user_id] = 1 |
530 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do | 533 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do |
531 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1| | 534 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1| |
532 get :annotate, :id => PRJ_ID, | 535 get :annotate, :id => PRJ_ID, |
533 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param], | 536 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param], |
534 :rev => r1 | 537 :rev => r1 |
535 assert_tag :tag => 'th', | 538 assert_select "th.line-num", :text => '1' do |
536 :content => '1', | 539 assert_select "+ td.revision" do |
537 :attributes => { :class => 'line-num' }, | 540 assert_select "a", :text => '57ca437c' |
538 :sibling => { :tag => 'td', | 541 assert_select "+ td.author", :text => "jsmith" do |
539 :content => /test-#{@char_1}.txt/ } | 542 assert_select "+ td", |
543 :text => "test-#{@char_1}.txt" | |
544 end | |
545 end | |
546 end | |
547 end | |
548 end | |
549 end | |
550 end | |
551 | |
552 def test_annotate_latin_1_author | |
553 ['83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', '83ca5fd546063a'].each do |r1| | |
554 get :annotate, :id => PRJ_ID, | |
555 :path => repository_path_hash([" filename with a leading space.txt "])[:param], | |
556 :rev => r1 | |
557 assert_select "th.line-num", :text => '1' do | |
558 assert_select "+ td.revision" do | |
559 assert_select "a", :text => '83ca5fd5' | |
560 assert_select "+ td.author", :text => @felix_utf8 do | |
561 assert_select "+ td", | |
562 :text => "And this is a file with a leading and trailing space..." | |
563 end | |
540 end | 564 end |
541 end | 565 end |
542 end | 566 end |
543 end | 567 end |
544 | 568 |