##// END OF EJS Templates
scm: git: add utf-8 log test in app unit test (#3396)....
Toshi MARUYAMA -
r4836:186a64c557a4
parent child
Show More
@@ -24,7 +24,10 class RepositoryGitTest < ActiveSupport::TestCase
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
25 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
25 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
26
26
27 FELIX_HEX = "Felix Sch\xC3\xA4fer"
28
27 def setup
29 def setup
30 Setting.commit_logs_encoding = 'UTF-8'
28 @project = Project.find(3)
31 @project = Project.find(3)
29 @repository = Repository::Git.create(:project => @project, :url => REPOSITORY_PATH)
32 @repository = Repository::Git.create(:project => @project, :url => REPOSITORY_PATH)
30 assert @repository
33 assert @repository
@@ -104,6 +107,17 class RepositoryGitTest < ActiveSupport::TestCase
104 assert c.event_title.include?('abc7234c:')
107 assert c.event_title.include?('abc7234c:')
105 assert_equal 'abc7234cb2750b63f47bff735edc50a1c0a433c2', c.event_url[:rev]
108 assert_equal 'abc7234cb2750b63f47bff735edc50a1c0a433c2', c.event_url[:rev]
106 end
109 end
110
111 def test_log_utf8
112 @repository.fetch_changesets
113 @repository.reload
114 str_felix_hex = FELIX_HEX
115 if str_felix_hex.respond_to?(:force_encoding)
116 str_felix_hex.force_encoding('UTF-8')
117 end
118 c = @repository.changesets.find_by_revision('ed5bb786bbda2dee66a2d50faf51429dbc043a7b')
119 assert_equal "#{str_felix_hex} <felix@fachschaften.org>", c.committer
120 end
107 else
121 else
108 puts "Git test repository NOT FOUND. Skipping unit tests !!!"
122 puts "Git test repository NOT FOUND. Skipping unit tests !!!"
109 def test_fake; assert true end
123 def test_fake; assert true end
General Comments 0
You need to be logged in to leave comments. Login now