]> source.dussan.org Git - redmine.git/commitdiff
Create tmp directory on test launch.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 1 Jun 2017 18:25:23 +0000 (18:25 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 1 Jun 2017 18:25:23 +0000 (18:25 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16587 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/test_helper.rb

index 1d99ce90685e9d058638ccee4f7a9f21c305f945..76771d438aaa6ee300a83fac3a09f71d6bf17703 100644 (file)
@@ -34,9 +34,13 @@ include ObjectHelpers
 
 require 'net/ldap'
 require 'mocha/setup'
+require 'fileutils'
 
 Redmine::SudoMode.disable!
 
+$redmine_tmp_attachments_directory = "#{Rails.root}/tmp/test/attachments"
+FileUtils.mkdir_p $redmine_tmp_attachments_directory
+
 class ActionView::TestCase
   helper :application
   include ApplicationHelper
@@ -68,11 +72,7 @@ class ActiveSupport::TestCase
 
   # Use a temporary directory for attachment related tests
   def set_tmp_attachments_directory
-    Dir.mkdir "#{Rails.root}/tmp/test" unless File.directory?("#{Rails.root}/tmp/test")
-    unless File.directory?("#{Rails.root}/tmp/test/attachments")
-      Dir.mkdir "#{Rails.root}/tmp/test/attachments"
-    end
-    Attachment.storage_path = "#{Rails.root}/tmp/test/attachments"
+    Attachment.storage_path = $redmine_tmp_attachments_directory
   end
 
   def set_fixtures_attachments_directory