summaryrefslogtreecommitdiffstats
path: root/test/unit/helpers
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-03-19 05:46:25 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-03-19 05:46:25 +0000
commite6e4256ee4bbc391e100ebc0ac36f7fd85f0c245 (patch)
tree3f4d9b9c072431f93d4e5a9de71007a5ecd00e47 /test/unit/helpers
parenta9d089dbcbeebde6b45b180cd023fba60d6ce13b (diff)
downloadredmine-e6e4256ee4bbc391e100ebc0ac36f7fd85f0c245.tar.gz
redmine-e6e4256ee4bbc391e100ebc0ac36f7fd85f0c245.zip
scm: to_utf8() in repositories_helper always returns UTF-8 in Ruby 1.9.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5165 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/helpers')
-rw-r--r--test/unit/helpers/repository_helper_test.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/unit/helpers/repository_helper_test.rb b/test/unit/helpers/repository_helper_test.rb
index c5e66055c..42b087ce4 100644
--- a/test/unit/helpers/repository_helper_test.rb
+++ b/test/unit/helpers/repository_helper_test.rb
@@ -69,5 +69,21 @@ class RepositoryHelperTest < HelperTestCase
assert_equal "", to_utf8("")
assert_equal nil, to_utf8(nil)
end
-end
+ def test_to_utf8_returns_ascii_as_utf8
+ s1 = "ASCII"
+ s2 = s1.dup
+ if s1.respond_to?(:force_encoding)
+ s1.force_encoding("UTF-8")
+ s2.force_encoding("ISO-8859-1")
+ end
+ str1 = to_utf8(s1)
+ str2 = to_utf8(s2)
+ assert_equal s1, str1
+ assert_equal s1, str2
+ if s1.respond_to?(:force_encoding)
+ assert_equal "UTF-8", str1.encoding.to_s
+ assert_equal "UTF-8", str2.encoding.to_s
+ end
+ end
+end