##// END OF EJS Templates
attachment: add a functional test to show invalid UTF-8 text file (#2371)...
Toshi MARUYAMA -
r7704:fdf6e8547b6b
parent child
Show More
@@ -0,0 +1,13
1 Index: trunk/app/controllers/issues_controller.rb
2 ===================================================================
3 --- trunk/app/controllers/issues_controller.rb (r�vision 1483)
4 +++ trunk/app/controllers/issues_controller.rb (r�vision 1484)
5 @@ -149,7 +149,7 @@
6 attach_files(@issue, params[:attachments])
7 flash[:notice] = 'Demande cr��e avec succ�s'
8 Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added')
9 - redirect_to :controller => 'issues', :action => 'show', :id => @issue, :project_id => @project
10 + redirect_to :controller => 'issues', :action => 'show', :id => @issue
11 return
12 end
13 end
@@ -91,6 +91,23 class AttachmentsControllerTest < ActionController::TestCase
91 :sibling => { :tag => 'td', :content => /#{str_japanese}/ }
91 :sibling => { :tag => 'td', :content => /#{str_japanese}/ }
92 end
92 end
93
93
94 def test_show_text_file_should_strip_non_utf8_content
95 a = Attachment.new(:container => Issue.find(1),
96 :file => uploaded_test_file("iso8859-1.txt", "text/plain"),
97 :author => User.find(1))
98 assert a.save
99 assert_equal 'iso8859-1.txt', a.filename
100
101 get :show, :id => a.id
102 assert_response :success
103 assert_template 'file'
104 assert_equal 'text/html', @response.content_type
105 assert_tag :tag => 'th',
106 :content => '7',
107 :attributes => { :class => 'line-num' },
108 :sibling => { :tag => 'td', :content => /Demande cre avec succs/ }
109 end
110
94 def test_show_text_file_should_send_if_too_big
111 def test_show_text_file_should_send_if_too_big
95 Setting.file_max_size_displayed = 512
112 Setting.file_max_size_displayed = 512
96 Attachment.find(4).update_attribute :filesize, 754.kilobyte
113 Attachment.find(4).update_attribute :filesize, 754.kilobyte
General Comments 0
You need to be logged in to leave comments. Login now