Blame SOURCES/rubygem-rack-test-0.6.3-Fix-test-uploaded-file.patch

c6149d
From fff392abc59c15427bec9105eb5f0f0bbda6cff9 Mon Sep 17 00:00:00 2001
c6149d
From: Raf Szalanski <rafal.szalanski@gmail.com>
c6149d
Date: Thu, 2 Jul 2015 22:31:40 +0000
c6149d
Subject: [PATCH]  Fix creation of tempfiles in Rack::Test::UploadedFile
c6149d
c6149d
Tempfile's initializer is not very intuitive. If you want your tempfile
c6149d
to have an extension you have to pass an array with two elements:
c6149d
  - basename
c6149d
  - extension (with a dot at the beginning)
c6149d
c6149d
This change makes it behave more like original Rack::Multipart::UploadedFile.
c6149d
---
c6149d
 lib/rack/test/uploaded_file.rb | 2 +-
c6149d
 1 file changed, 1 insertion(+), 1 deletion(-)
c6149d
c6149d
diff --git a/lib/rack/test/uploaded_file.rb b/lib/rack/test/uploaded_file.rb
c6149d
index d0d3e2a..3339412 100644
c6149d
--- a/lib/rack/test/uploaded_file.rb
c6149d
+++ b/lib/rack/test/uploaded_file.rb
c6149d
@@ -26,7 +26,7 @@ def initialize(path, content_type = "text/plain", binary = false)
c6149d
         @content_type = content_type
c6149d
         @original_filename = ::File.basename(path)
c6149d
 
c6149d
-        @tempfile = Tempfile.new(@original_filename)
c6149d
+        @tempfile = Tempfile.new([@original_filename, ::File.extname(path)])
c6149d
         @tempfile.set_encoding(Encoding::BINARY) if @tempfile.respond_to?(:set_encoding)
c6149d
         @tempfile.binmode if binary
c6149d