summaryrefslogtreecommitdiffstats
path: root/test/functional/attachments_controller_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-20 11:47:45 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-20 11:47:45 +0000
commitc1ed67c7417830062afb1b4f00286077812eae81 (patch)
treee2ff360db3870949705f20ee7eb3360e193334f2 /test/functional/attachments_controller_test.rb
parentc6191cdc82cd0b74860ba7f6b3d6d32b77439548 (diff)
downloadredmine-c1ed67c7417830062afb1b4f00286077812eae81.tar.gz
redmine-c1ed67c7417830062afb1b4f00286077812eae81.zip
attachment: add a functional test to show an ISO-8859-1 content file (#2371)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7868 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/attachments_controller_test.rb')
-rw-r--r--test/functional/attachments_controller_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index 1e8376ad4..cdab931be 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -135,6 +135,26 @@ class AttachmentsControllerTest < ActionController::TestCase
end
end
+ def test_show_text_file_latin_1
+ set_tmp_attachments_directory
+ with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' 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
Setting.file_max_size_displayed = 512
Attachment.find(4).update_attribute :filesize, 754.kilobyte