diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-03-19 05:46:47 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-03-19 05:46:47 +0000 |
commit | 09996c35241b60e734d28b892caf398e7540b7be (patch) | |
tree | 0f164a13827287a434df26b7d30a8dee324032fb /test | |
parent | e6e4256ee4bbc391e100ebc0ac36f7fd85f0c245 (diff) | |
download | redmine-09996c35241b60e734d28b892caf398e7540b7be.tar.gz redmine-09996c35241b60e734d28b892caf398e7540b7be.zip |
scm: add unit test of invalid utf8 sequences should be stripped in repository_helper to_utf8().
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5166 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/helpers/repository_helper_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/helpers/repository_helper_test.rb b/test/unit/helpers/repository_helper_test.rb index 42b087ce4..23067ea54 100644 --- a/test/unit/helpers/repository_helper_test.rb +++ b/test/unit/helpers/repository_helper_test.rb @@ -86,4 +86,18 @@ class RepositoryHelperTest < HelperTestCase assert_equal "UTF-8", str2.encoding.to_s end end + + def test_to_utf8_invalid_utf8_sequences_should_be_stripped + with_settings :repositories_encodings => '' do + s1 = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt") + str = to_utf8(s1) + if str.respond_to?(:force_encoding) + assert_equal "Texte encod? en ISO-8859-1.", str + assert str.valid_encoding? + assert_equal "UTF-8", str.encoding.to_s + else + assert_equal "Texte encod en ISO-8859-1.", str + end + end + end end |