<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -4,7 +4,8 @@ module IOStream
 
   # Returns a Tempfile containing the contents of the readable object.
   def to_tempfile
-    tempfile = Tempfile.new(&quot;stream&quot;)
+    name = respond_to?(:original_filename) ? original_filename : (respond_to?(:path) ? path : &quot;stream&quot;)
+    tempfile = Paperclip::Tempfile.new(File.basename(name))
     tempfile.binmode
     self.stream_to(tempfile)
   end</diff>
      <filename>lib/paperclip/iostream.rb</filename>
    </modified>
    <modified>
      <diff>@@ -133,7 +133,7 @@ class AttachmentTest &lt; Test::Unit::TestCase
                                :styles =&gt; { :default =&gt; [&quot;100x100&quot;, :png] },
                                :default_style =&gt; :default
       @file = StringIO.new(&quot;...&quot;)
-      @file.expects(:original_filename).returns(&quot;file.jpg&quot;)
+      @file.stubs(:original_filename).returns(&quot;file.jpg&quot;)
     end
     should &quot;return the right extension for the path&quot; do
       @attachment.assign(@file)</diff>
      <filename>test/attachment_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ require 'test/unit'
 require 'shoulda'
 require 'tempfile'
 
-gem 'jferris-mocha', '0.9.5.0.1241126838'
+gem 'jferris-mocha'
 require 'mocha'
 
 gem 'sqlite3-ruby'</diff>
      <filename>test/helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -58,8 +58,15 @@ class IOStreamTest &lt; Test::Unit::TestCase
         assert @tempfile = @file.to_tempfile
       end
 
-      should &quot;convert it to a Tempfile&quot; do
-        assert @tempfile.is_a?(Tempfile)
+      should &quot;convert it to a Paperclip Tempfile&quot; do
+        assert @tempfile.is_a?(Paperclip::Tempfile)
+      end
+
+      should &quot;have the name be based on the original_filename&quot; do
+        name = File.basename(@file.path)
+        extension = File.extname(name)
+        basename = File.basename(name, extension)
+        assert_match %r[^#{Regexp.quote(basename)}.*?#{Regexp.quote(extension)}], File.basename(@tempfile.path)
       end
 
       should &quot;have the Tempfile contain the same data as the file&quot; do</diff>
      <filename>test/iostream_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>68286d689d956abe17f77e9e5b7c9537e8530bbc</id>
    </parent>
  </parents>
  <author>
    <name>Jon Yurek</name>
    <email>jyurek@thoughtbot.com</email>
  </author>
  <url>http://github.com/thoughtbot/paperclip/commit/c64223c60dd7b0c4c4bc218de906061a6563a5a8</url>
  <id>c64223c60dd7b0c4c4bc218de906061a6563a5a8</id>
  <committed-date>2009-11-04T15:58:47-08:00</committed-date>
  <authored-date>2009-11-04T15:58:47-08:00</authored-date>
  <message>Fixed an error where ImageMagick wasn't identifying images because the Tempfiles did not have the right extension.</message>
  <tree>f98940b77f1d63dc2ea42a2cafd9bf5eb74c9ba1</tree>
  <committer>
    <name>Jon Yurek</name>
    <email>jyurek@thoughtbot.com</email>
  </committer>
</commit>
