@@ -0,0 +1,1 | |||||
|
1 | 日本語 |
@@ -71,6 +71,26 class AttachmentsControllerTest < ActionController::TestCase | |||||
71 | assert_equal 'text/html', @response.content_type |
|
71 | assert_equal 'text/html', @response.content_type | |
72 | end |
|
72 | end | |
73 |
|
73 | |||
|
74 | def test_show_text_file_utf_8 | |||
|
75 | a = Attachment.new(:container => Issue.find(1), | |||
|
76 | :file => uploaded_test_file("japanese-utf-8.txt", "text/plain"), | |||
|
77 | :author => User.find(1)) | |||
|
78 | assert a.save | |||
|
79 | assert_equal 'japanese-utf-8.txt', a.filename | |||
|
80 | ||||
|
81 | str_japanese = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e" | |||
|
82 | str_japanese.force_encoding('UTF-8') if str_japanese.respond_to?(:force_encoding) | |||
|
83 | ||||
|
84 | get :show, :id => a.id | |||
|
85 | assert_response :success | |||
|
86 | assert_template 'file' | |||
|
87 | assert_equal 'text/html', @response.content_type | |||
|
88 | assert_tag :tag => 'th', | |||
|
89 | :content => '1', | |||
|
90 | :attributes => { :class => 'line-num' }, | |||
|
91 | :sibling => { :tag => 'td', :content => /#{str_japanese}/ } | |||
|
92 | end | |||
|
93 | ||||
74 | def test_show_text_file_should_send_if_too_big |
|
94 | def test_show_text_file_should_send_if_too_big | |
75 | Setting.file_max_size_displayed = 512 |
|
95 | Setting.file_max_size_displayed = 512 | |
76 | Attachment.find(4).update_attribute :filesize, 754.kilobyte |
|
96 | Attachment.find(4).update_attribute :filesize, 754.kilobyte |
General Comments 0
You need to be logged in to leave comments.
Login now