Commit dd2870128afd53b714e1275ffd25e835c35ef118

Authored by Daniela Feitosa
2 parents da6c1271 72790af0

Merge branch 'AI3131' of https://gitlab.com/arthurmde/noosfero into AI3131

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
... ...