<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Speeding up Paperclip Tests by&#8230; a LOT</title>
	<atom:link href="http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/feed/" rel="self" type="application/rss+xml" />
	<link>http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/</link>
	<description>A chess-playing machine of the late 18th century, promoted as an automaton but later proved a hoax.</description>
	<lastBuildDate>Wed, 08 Feb 2012 17:13:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jamie Flournoy</title>
		<link>http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/#comment-843</link>
		<dc:creator><![CDATA[Jamie Flournoy]]></dc:creator>
		<pubDate>Tue, 20 Apr 2010 12:21:58 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=1218#comment-843</guid>
		<description><![CDATA[The &quot;Too many open files&quot; problem is caused by stubbing out save_attached_files. The storage classes (Paperclip::Storage::S3 and Paperclip::Storage::Filesystem) are responsible for closing the temporary file in the flush_writes method, but that never gets called when you stub save_attached_files.
 

 
Instead, replace flush_writes with something like this:
 

 
      def flush_writes
 
        @queued_for_write.each{&#124;style, file&#124; file.close}
 
        @queued_for_write = {}
 
      end ]]></description>
		<content:encoded><![CDATA[<p>The &quot;Too many open files&quot; problem is caused by stubbing out save_attached_files. The storage classes (Paperclip::Storage::S3 and Paperclip::Storage::Filesystem) are responsible for closing the temporary file in the flush_writes method, but that never gets called when you stub save_attached_files.</p>
<p>Instead, replace flush_writes with something like this:</p>
<p>      def flush_writes</p>
<p>        @queued_for_write.each{|style, file| file.close}</p>
<p>        @queued_for_write = {}</p>
<p>      end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/#comment-842</link>
		<dc:creator><![CDATA[Trevor]]></dc:creator>
		<pubDate>Fri, 06 Nov 2009 15:21:14 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=1218#comment-842</guid>
		<description><![CDATA[Cool - thanks for the feedback! ]]></description>
		<content:encoded><![CDATA[<p>Cool &#8211; thanks for the feedback!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Madsen</title>
		<link>http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/#comment-841</link>
		<dc:creator><![CDATA[Steve Madsen]]></dc:creator>
		<pubDate>Fri, 06 Nov 2009 09:32:11 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=1218#comment-841</guid>
		<description><![CDATA[Based on my debugging, it appears so, but I&#039;m also using very small files for these tests. Any additional overhead in save_attached_files is not impacting the test run time, and it is allowing Paperclip to clean up the temporary files it creates.
 

 
A slow test is a problem, but failing due to a problem outside my code is worse. :-) ]]></description>
		<content:encoded><![CDATA[<p>Based on my debugging, it appears so, but I&#039;m also using very small files for these tests. Any additional overhead in save_attached_files is not impacting the test run time, and it is allowing Paperclip to clean up the temporary files it creates.</p>
<p>A slow test is a problem, but failing due to a problem outside my code is worse. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/#comment-840</link>
		<dc:creator><![CDATA[Trevor]]></dc:creator>
		<pubDate>Fri, 06 Nov 2009 00:12:19 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=1218#comment-840</guid>
		<description><![CDATA[Steve, so you&#039;re saying it&#039;s best to just stub out the &quot;post_process&quot; method? I suppose that would at least save all the time for generating thumbnails... ]]></description>
		<content:encoded><![CDATA[<p>Steve, so you&#039;re saying it&#039;s best to just stub out the &quot;post_process&quot; method? I suppose that would at least save all the time for generating thumbnails&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Madsen</title>
		<link>http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/#comment-839</link>
		<dc:creator><![CDATA[Steve Madsen]]></dc:creator>
		<pubDate>Thu, 05 Nov 2009 23:37:31 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=1218#comment-839</guid>
		<description><![CDATA[This technique has worked really well for me for a couple of months now, until tonight. I accumulated enough functional tests with stubbed out Paperclip methods that I hit too many open files and my tests started failing inside Paperclip:
 

 
Errno::EMFILE: Too many open files - /var/folders/45/45kdBsmpGF0A-mb8hYDQxU+++TM/-Tmp-/stream.25027.213
 
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/tempfile.rb:55:in `initialize&#039;
 
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/tempfile.rb:55:in `open&#039;
 
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/tempfile.rb:55:in `initialize&#039;
 
    vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/iostream.rb:7:in `new&#039;
 
    vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/iostream.rb:7:in `to_tempfile&#039;
 
    vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/attachment.rb:79:in `assign&#039;
 
    vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip.rb:232:in `image=&#039;
 

 
The solution seems to be to NOT stub out save_attached_files and delete_attached_files, and it doesn&#039;t impact the run time of the tests, either. ]]></description>
		<content:encoded><![CDATA[<p>This technique has worked really well for me for a couple of months now, until tonight. I accumulated enough functional tests with stubbed out Paperclip methods that I hit too many open files and my tests started failing inside Paperclip:</p>
<p>Errno::EMFILE: Too many open files &#8211; /var/folders/45/45kdBsmpGF0A-mb8hYDQxU+++TM/-Tmp-/stream.25027.213</p>
<p>    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/tempfile.rb:55:in `initialize&#039;</p>
<p>    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/tempfile.rb:55:in `open&#039;</p>
<p>    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/tempfile.rb:55:in `initialize&#039;</p>
<p>    vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/iostream.rb:7:in `new&#039;</p>
<p>    vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/iostream.rb:7:in `to_tempfile&#039;</p>
<p>    vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/attachment.rb:79:in `assign&#039;</p>
<p>    vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip.rb:232:in `image=&#039;</p>
<p>The solution seems to be to NOT stub out save_attached_files and delete_attached_files, and it doesn&#039;t impact the run time of the tests, either.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xavius</title>
		<link>http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/#comment-838</link>
		<dc:creator><![CDATA[Xavius]]></dc:creator>
		<pubDate>Mon, 24 Aug 2009 10:37:41 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=1218#comment-838</guid>
		<description><![CDATA[Trevor, would you be able to include another posts with some basics on how to use Test::Unit to create functional tests for controllers associated with paperclip models? ]]></description>
		<content:encoded><![CDATA[<p>Trevor, would you be able to include another posts with some basics on how to use Test::Unit to create functional tests for controllers associated with paperclip models?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodney</title>
		<link>http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/#comment-837</link>
		<dc:creator><![CDATA[Rodney]]></dc:creator>
		<pubDate>Thu, 07 May 2009 17:16:25 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=1218#comment-837</guid>
		<description><![CDATA[Thanks for posting that!  I don&#039;t know if it&#039;s my version of paperclip, but I have to use :destroy_attached_files, instead.
 

 
Photo.any_instance.stubs(:delete_attached_files).returns(true) ]]></description>
		<content:encoded><![CDATA[<p>Thanks for posting that!  I don&#039;t know if it&#039;s my version of paperclip, but I have to use :destroy_attached_files, instead.</p>
<p>Photo.any_instance.stubs(:delete_attached_files).returns(true)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dev Blog AF83 &#187; Blog Archive &#187; Veille technologique : Navigateurs web, Subversion, Javascript, Frameworks, Tests unitaires, Méthodes, Logiciel Libre</title>
		<link>http://trevorturk.wordpress.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/#comment-836</link>
		<dc:creator><![CDATA[Dev Blog AF83 &#187; Blog Archive &#187; Veille technologique : Navigateurs web, Subversion, Javascript, Frameworks, Tests unitaires, Méthodes, Logiciel Libre]]></dc:creator>
		<pubDate>Mon, 16 Mar 2009 17:43:48 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=1218#comment-836</guid>
		<description><![CDATA[[...] http://almosteffortless.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/ : une technique pour accélérer les tests unitaires en présence de paperclip [...] ]]></description>
		<content:encoded><![CDATA[<p>[...] <a href="http://almosteffortless.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/" rel="nofollow">http://almosteffortless.com/2009/03/12/speeding-up-paperclip-tests-by-a-lot/</a> : une technique pour accélérer les tests unitaires en présence de paperclip [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

