summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-20 11:24:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-20 11:24:41 +0000
commit46aa855572a26a1b0fab211e4ec79453ac8790fc (patch)
treeece0c59a51d34c5306cbdcbd250a4e1352de5f40 /test/unit
parent6e689215908185642990dc9bf010b627f06e6124 (diff)
downloadredmine-46aa855572a26a1b0fab211e4ec79453ac8790fc.tar.gz
redmine-46aa855572a26a1b0fab211e4ec79453ac8790fc.zip
Remove invalid utf8 sequences from commit comments and author name (#4773).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3466 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/changeset_test.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb
index 8d57c43ab..8010383fe 100644
--- a/test/unit/changeset_test.rb
+++ b/test/unit/changeset_test.rb
@@ -1,5 +1,7 @@
-# redMine - project management software
-# Copyright (C) 2006-2007 Jean-Philippe Lang
+# encoding: utf-8
+#
+# Redmine - project management software
+# Copyright (C) 2006-2010 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -117,4 +119,18 @@ class ChangesetTest < ActiveSupport::TestCase
changeset = Changeset.find_by_revision('10')
assert_nil changeset.next
end
+
+ def test_comments_should_be_converted_to_utf8
+ with_settings :commit_logs_encoding => 'ISO-8859-1' do
+ c = Changeset.new
+ c.comments = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
+ assert_equal "Texte encodé en ISO-8859-1.", c.comments
+ end
+ end
+
+ def test_invalid_utf8_sequences_in_comments_should_be_stripped
+ c = Changeset.new
+ c.comments = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
+ assert_equal "Texte encod en ISO-8859-1.", c.comments
+ end
end