]> source.dussan.org Git - redmine.git/commitdiff
Run test only when GhostScript is available (#22481).
authorGo MAEDA <maeda@farend.jp>
Sun, 2 Jun 2019 23:39:15 +0000 (23:39 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 2 Jun 2019 23:39:15 +0000 (23:39 +0000)
Patch by Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@18221 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/attachments_controller_test.rb
test/test_helper.rb

index a784032544377c12d602f69ad8a86a9028b97537..f94c73280d7edfafb3234788f9d5af628ebe15ef 100644 (file)
@@ -404,16 +404,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
       assert_response 304
     end
 
-    def test_thumbnail_for_pdf_should_be_png
-      Attachment.clear_thumbnails
-      @request.session[:user_id] = 2
-      get :thumbnail, :params => {
-          :id => 23   # ecookbook-gantt.pdf
-        }
-      assert_response :success
-      assert_equal 'image/png', response.content_type
-    end
-
     def test_thumbnail_should_not_exceed_maximum_size
       Redmine::Thumbnail.expects(:generate).with {|source, target, size| size == 800}
 
@@ -463,6 +453,20 @@ class AttachmentsControllerTest < Redmine::ControllerTest
     puts '(ImageMagick convert not available)'
   end
 
+  if gs_installed?
+    def test_thumbnail_for_pdf_should_be_png
+      Attachment.clear_thumbnails
+      @request.session[:user_id] = 2
+      get :thumbnail, :params => {
+          :id => 23   # ecookbook-gantt.pdf
+        }
+      assert_response :success
+      assert_equal 'image/png', response.content_type
+    end
+  else
+    puts '(GhostScript convert not available)'
+  end
+
   def test_edit_all
     @request.session[:user_id] = 2
     get :edit_all, :params => {
index 521caeb3cd648be55500b58e21f2a4bb01611f28..390ea92b48ae687d8a01a739e7ce3ee628cd7164 100644 (file)
@@ -134,6 +134,14 @@ class ActiveSupport::TestCase
     self.class.convert_installed?
   end
 
+  def self.gs_installed?
+    Redmine::Thumbnail.gs_available?
+  end
+
+  def gs_installed?
+    self.class.gs_installed?
+  end
+
   # Returns the path to the test +vendor+ repository
   def self.repository_path(vendor)
     path = Rails.root.join("tmp/test/#{vendor.downcase}_repository").to_s