summaryrefslogtreecommitdiffstats
path: root/test/functional/repositories_bazaar_controller_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-09-18 14:22:44 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-09-18 14:22:44 +0000
commit5aa8358f97d29dcce71bef48089ac7f86550fc62 (patch)
tree388227f0d978b492ebe22a03d1202de26d419526 /test/functional/repositories_bazaar_controller_test.rb
parent120689e7cb48eb87d49827eb5ce7f9c12d689aaf (diff)
downloadredmine-5aa8358f97d29dcce71bef48089ac7f86550fc62.tar.gz
redmine-5aa8358f97d29dcce71bef48089ac7f86550fc62.zip
scm: fix annotate error with non ASCII author on Ruby 1.9 and Ruby 2.0 (#14931)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12156 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/repositories_bazaar_controller_test.rb')
-rw-r--r--test/functional/repositories_bazaar_controller_test.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/repositories_bazaar_controller_test.rb b/test/functional/repositories_bazaar_controller_test.rb
index 46a71d231..b4d7d7276 100644
--- a/test/functional/repositories_bazaar_controller_test.rb
+++ b/test/functional/repositories_bazaar_controller_test.rb
@@ -26,6 +26,7 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase
REPOSITORY_PATH = Rails.root.join('tmp/test/bazaar_repository').to_s
REPOSITORY_PATH_TRUNK = File.join(REPOSITORY_PATH, "trunk")
PRJ_ID = 3
+ CHAR_1_UTF8_HEX = "\xc3\x9c"
def setup
User.current = nil
@@ -35,6 +36,10 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase
:url => REPOSITORY_PATH_TRUNK,
:log_encoding => 'UTF-8')
assert @repository
+ @char_1_utf8 = CHAR_1_UTF8_HEX.dup
+ if @char_1_utf8.respond_to?(:force_encoding)
+ @char_1_utf8.force_encoding('UTF-8')
+ end
end
if File.directory?(REPOSITORY_PATH)
@@ -171,6 +176,37 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase
end
end
+ if REPOSITORY_PATH.respond_to?(:force_encoding)
+ def test_annotate_author_non_ascii
+ log_encoding = nil
+ if Encoding.locale_charmap == "UTF-8" ||
+ Encoding.locale_charmap == "ISO-8859-1"
+ log_encoding = Encoding.locale_charmap
+ end
+ unless log_encoding.nil?
+ repository = Repository::Bazaar.create(
+ :project => @project,
+ :url => File.join(REPOSITORY_PATH, "author_non_ascii"),
+ :identifier => 'author_non_ascii',
+ :log_encoding => log_encoding)
+ assert repository
+ get :annotate, :id => PRJ_ID, :repository_id => 'author_non_ascii',
+ :path => repository_path_hash(['author-non-ascii-test.txt'])[:param]
+ assert_response :success
+ assert_template 'annotate'
+ assert_select "th.line-num", :text => '1' do
+ assert_select "+ td.revision" do
+ assert_select "a", :text => '2'
+ assert_select "+ td.author", :text => "test #{@char_1_utf8}" do
+ assert_select "+ td",
+ :text => "author non ASCII test"
+ end
+ end
+ end
+ end
+ end
+ end
+
def test_destroy_valid_repository
@request.session[:user_id] = 1 # admin
assert_equal 0, @repository.changesets.count