diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-20 11:46:52 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-20 11:46:52 +0000 |
commit | 77710ece26d8503e365a5211b010eb9be81c1c99 (patch) | |
tree | 2dee610d4510b49b48a7d865ed62a81461a4b1b9 /test/functional | |
parent | 85db02d486d658c1d0e83f915a39fac5a6ed6b27 (diff) | |
download | redmine-77710ece26d8503e365a5211b010eb9be81c1c99.tar.gz redmine-77710ece26d8503e365a5211b010eb9be81c1c99.zip |
attachment: use repositories setting to convert contents character encoding (#2371)
This commit results replacing invalid encoding instead to stripping.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7866 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/attachments_controller_test.rb | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb index 1fce6c0c9..879f6edca 100644 --- a/test/functional/attachments_controller_test.rb +++ b/test/functional/attachments_controller_test.rb @@ -52,19 +52,21 @@ class AttachmentsControllerTest < ActionController::TestCase end end - def test_show_diff_should_strip_non_utf8_content - ['inline', 'sbs'].each do |dt| - # 060719210727_changeset_iso8859-1.diff - get :show, :id => 5, :type => dt - assert_response :success - assert_template 'diff' - assert_equal 'text/html', @response.content_type - assert_tag 'th', - :attributes => {:class => /filename/}, - :content => /issues_controller.rb\t\(rvision 1484\)/ - assert_tag 'td', - :attributes => {:class => /line-code/}, - :content => /Demande cre avec succs/ + def test_show_diff_replcace_cannot_convert_content + with_settings :repositories_encodings => 'UTF-8' do + ['inline', 'sbs'].each do |dt| + # 060719210727_changeset_iso8859-1.diff + get :show, :id => 5 + assert_response :success + assert_template 'diff' + assert_equal 'text/html', @response.content_type + assert_tag 'th', + :attributes => {:class => "filename"}, + :content => /issues_controller.rb\t\(r\?vision 1484\)/ + assert_tag 'td', + :attributes => {:class => /line-code/}, + :content => /Demande cr\?\?e avec succ\?s/ + end end end @@ -96,22 +98,24 @@ class AttachmentsControllerTest < ActionController::TestCase :sibling => { :tag => 'td', :content => /#{str_japanese}/ } end - def test_show_text_file_should_strip_non_utf8_content + def test_show_text_file_replcace_cannot_convert_content set_tmp_attachments_directory - a = Attachment.new(:container => Issue.find(1), - :file => uploaded_test_file("iso8859-1.txt", "text/plain"), - :author => User.find(1)) - assert a.save - assert_equal 'iso8859-1.txt', a.filename - - get :show, :id => a.id - assert_response :success - assert_template 'file' - assert_equal 'text/html', @response.content_type - assert_tag :tag => 'th', - :content => '7', - :attributes => { :class => 'line-num' }, - :sibling => { :tag => 'td', :content => /Demande cre avec succs/ } + with_settings :repositories_encodings => 'UTF-8' do + a = Attachment.new(:container => Issue.find(1), + :file => uploaded_test_file("iso8859-1.txt", "text/plain"), + :author => User.find(1)) + assert a.save + assert_equal 'iso8859-1.txt', a.filename + + get :show, :id => a.id + assert_response :success + assert_template 'file' + assert_equal 'text/html', @response.content_type + assert_tag :tag => 'th', + :content => '7', + :attributes => { :class => 'line-num' }, + :sibling => { :tag => 'td', :content => /Demande cr\?\?e avec succ\?s/ } + end end def test_show_text_file_should_send_if_too_big |