@@ -0,0 +1,3 | |||
|
1 | <%= render :layout => 'layouts/file' do %> | |
|
2 | <%= render :partial => 'common/other' %> | |
|
3 | <% end %> |
@@ -43,7 +43,7 class AttachmentsController < ApplicationController | |||
|
43 | 43 | elsif @attachment.is_image? |
|
44 | 44 | render :action => 'image' |
|
45 | 45 | else |
|
46 | download | |
|
46 | render :action => 'other' | |
|
47 | 47 | end |
|
48 | 48 | } |
|
49 | 49 | format.api |
@@ -179,12 +179,13 class AttachmentsControllerTest < ActionController::TestCase | |||
|
179 | 179 | end |
|
180 | 180 | end |
|
181 | 181 | |
|
182 |
def test_show_text_file_should_s |
|
|
182 | def test_show_text_file_should_show_other_if_too_big | |
|
183 | 183 | with_settings :file_max_size_displayed => 512 do |
|
184 | 184 | Attachment.find(4).update_attribute :filesize, 754.kilobyte |
|
185 | 185 | get :show, :id => 4 |
|
186 | 186 | assert_response :success |
|
187 | assert_equal 'application/x-ruby', @response.content_type | |
|
187 | assert_template 'other' | |
|
188 | assert_equal 'text/html', @response.content_type | |
|
188 | 189 | end |
|
189 | 190 | set_tmp_attachments_directory |
|
190 | 191 | end |
@@ -200,8 +201,9 class AttachmentsControllerTest < ActionController::TestCase | |||
|
200 | 201 | |
|
201 | 202 | def test_show_other |
|
202 | 203 | get :show, :id => 6 |
|
203 | assert_response :success | |
|
204 |
assert_equal ' |
|
|
204 | assert_template 'other' | |
|
205 | assert_equal 'text/html', @response.content_type | |
|
206 | assert_select '.nodata', :text => 'No preview available' | |
|
205 | 207 | set_tmp_attachments_directory |
|
206 | 208 | end |
|
207 | 209 |
General Comments 0
You need to be logged in to leave comments.
Login now