Commit 72790af069f65a3a0ab0113d0a7ac2fa99322d0a

Authored by Arthur Esposte
1 parent 5da04adb

AI3131 - fixing bug in add image to articles, header and footer

app/presenters/image.rb
... ... @@ -11,4 +11,8 @@ class FilePresenter::Image < FilePresenter
11 11 def short_description
12 12 _('Image (%s)') % content_type.split('/')[1].upcase
13 13 end
  14 +
  15 + def download? view = nil
  16 + view.blank? || view == 'false'
  17 + end
14 18 end
... ...
test/functional/content_viewer_controller_test.rb
... ... @@ -75,6 +75,18 @@ class ContentViewerControllerTest < ActionController::TestCase
75 75 assert_match /#{html.public_filename}/, @response.body
76 76 end
77 77  
  78 + should 'produce a download-link when article is a image' do
  79 + profile = create_user('someone').person
  80 + image = UploadedFile.create! :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => profile
  81 + image.save!
  82 +
  83 + get :view_page, :profile => 'someone', :page => [ 'rails.png' ]
  84 +
  85 + assert_response :success
  86 + assert_not_nil assigns(:page).data
  87 + assert_match /image/, @response.headers['Content-Type']
  88 + end
  89 +
78 90 should 'produce a download-link when article is not text/html' do
79 91  
80 92 # for example, RSS feeds
... ...