summaryrefslogtreecommitdiffstats
path: root/test/unit/attachment_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-08-18 02:47:32 +0000
committerGo MAEDA <maeda@farend.jp>2021-08-18 02:47:32 +0000
commit1bfdccc30fb873ec72c25e29f1bbbfb6c462ca6a (patch)
tree57e6a65e92b2bd21f51e24dec3441f9734dee9e9 /test/unit/attachment_test.rb
parent1578c7207bcd52c3089cc1d8ad0e7fb688d91fa3 (diff)
downloadredmine-1bfdccc30fb873ec72c25e29f1bbbfb6c462ca6a.tar.gz
redmine-1bfdccc30fb873ec72c25e29f1bbbfb6c462ca6a.zip
Don't unlink files before closing them (#35539, #35721).
Patch by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@21194 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/attachment_test.rb')
-rw-r--r--test/unit/attachment_test.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb
index 2aee87964..a870e3697 100644
--- a/test/unit/attachment_test.rb
+++ b/test/unit/attachment_test.rb
@@ -276,27 +276,31 @@ class AttachmentTest < ActiveSupport::TestCase
end
def test_create_diskfile
+ path = nil
Attachment.create_diskfile("test_file.txt") do |f|
path = f.path
assert_match(/^\d{12}_test_file.txt$/, File.basename(path))
assert_equal 'test_file.txt', File.basename(path)[13..-1]
- File.unlink f.path
end
+ File.unlink path
Attachment.create_diskfile("test_accentué.txt") do |f|
+ path = f.path
assert_equal '770c509475505f37c2b8fb6030434d6b.txt', File.basename(f.path)[13..-1]
- File.unlink f.path
end
+ File.unlink path
Attachment.create_diskfile("test_accentué") do |f|
+ path = f.path
assert_equal 'f8139524ebb8f32e51976982cd20a85d', File.basename(f.path)[13..-1]
- File.unlink f.path
end
+ File.unlink path
Attachment.create_diskfile("test_accentué.ça") do |f|
+ path = f.path
assert_equal 'cbb5b0f30978ba03731d61f9f6d10011', File.basename(f.path)[13..-1]
- File.unlink f.path
end
+ File.unlink path
end
def test_title