<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pivotal Labs &#187; Desmond Bowe</title>
	<atom:link href="http://pivotallabs.com/author/dbowe/feed/" rel="self" type="application/rss+xml" />
	<link>http://pivotallabs.com</link>
	<description>Agility Developed</description>
	<lastBuildDate>Wed, 19 Jun 2013 07:57:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Avoid using fixture_file_upload with FactoryGirl and Paperclip</title>
		<link>http://pivotallabs.com/avoid-using-fixture-file-upload-with-factorygirl-and-paperclip/</link>
		<comments>http://pivotallabs.com/avoid-using-fixture-file-upload-with-factorygirl-and-paperclip/#comments</comments>
		<pubDate>Fri, 21 Sep 2012 15:45:00 +0000</pubDate>
		<dc:creator>Desmond Bowe</dc:creator>
				<category><![CDATA[Labs]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/avoid-using-fixture-file-upload-with-factorygirl-and-paperclip/</guid>
		<description><![CDATA[<p><p><a href="http://pivotallabs.com/users/joe/blog">Joe Moore</a> and I are using <a href="https://github.com/thoughtbot/factory_girl">FactoryGirl</a> and <a href="https://github.com/thoughtbot/paperclip">Paperclip</a> for file attachments.  The factory for building our Attachment model looked like this:</p>

<pre><code> factory :attachment do
   supporting_documentation { fixture_file_upload&#40;'test.pdf', 'application/pdf'&#41; }
   # ...
 end
</code></pre>

<p>Yesterday our test suite began raising the following error:</p>

<pre><code> Failure/Error: let&#40;:attachment&#41; { FactoryGirl.create&#40;:attachment&#41; }
 Errno::EMFILE:
   Too many open files - /var/folders/3q/_15370v96jlbnxsk3whsks5c0000gn/T/test20120920-4004-7c2o9y.pdf
</code></pre>

<p>It turns out that Rails' <code>fixture_file_upload</code> method does not close the temporary file it creates.  We found <a href="http://apidock.com/rails/ActionDispatch/TestProcess/fixture_file_upload#1234-To-use-with-factory-girl-and-prevent-leaking-file-handles" title="fixture_file_upload (ActionDispatch::TestProcess) - APIdock">a suggestion to prevent leaking file handles</a> by adding an <code>after_create</code> block that manually closes the file. We tested this fix by looping through the model spec 1000 times.  More tests passed, but it eventually blew up with the same error.  </p>

<p>Using <code>fixture_file_upload</code> needlessly exercises Paperclip's file uploading functionality instead of just creating the models we care about for our application. Instead, explicitly set the attributes Paperclip needs: </p>

<pre><code> factory :attachment do
   supporting_documentation_file_name { 'test.pdf' }
   supporting_documentation_content_type { 'application/pdf' }
   supporting_documentation_file_size { 1024 }
   # ...
 end
</code></pre>

<p>...and all of our tests passed.</p>

<p>Conclusion: in model factories, set the Paperclip attributes directly and don't use <code>fixture_file_upload</code>.</p> <a href="http://pivotallabs.com/avoid-using-fixture-file-upload-with-factorygirl-and-paperclip/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/avoid-using-fixture-file-upload-with-factorygirl-and-paperclip/">Avoid using fixture_file_upload with FactoryGirl and Paperclip</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://pivotallabs.com/users/joe/blog">Joe Moore</a> and I are using <a href="https://github.com/thoughtbot/factory_girl">FactoryGirl</a> and <a href="https://github.com/thoughtbot/paperclip">Paperclip</a> for file attachments.  The factory for building our Attachment model looked like this:</p>
<pre><code> factory :attachment do
   supporting_documentation { fixture_file_upload&#40;'test.pdf', 'application/pdf'&#41; }
   # ...
 end
</code></pre>
<p>Yesterday our test suite began raising the following error:</p>
<pre><code> Failure/Error: let&#40;:attachment&#41; { FactoryGirl.create&#40;:attachment&#41; }
 Errno::EMFILE:
   Too many open files - /var/folders/3q/_15370v96jlbnxsk3whsks5c0000gn/T/test20120920-4004-7c2o9y.pdf
</code></pre>
<p>It turns out that Rails&#8217; <code>fixture_file_upload</code> method does not close the temporary file it creates.  We found <a href="http://apidock.com/rails/ActionDispatch/TestProcess/fixture_file_upload#1234-To-use-with-factory-girl-and-prevent-leaking-file-handles" title="fixture_file_upload (ActionDispatch::TestProcess) - APIdock">a suggestion to prevent leaking file handles</a> by adding an <code>after_create</code> block that manually closes the file. We tested this fix by looping through the model spec 1000 times.  More tests passed, but it eventually blew up with the same error.  </p>
<p>Using <code>fixture_file_upload</code> needlessly exercises Paperclip&#8217;s file uploading functionality instead of just creating the models we care about for our application. Instead, explicitly set the attributes Paperclip needs: </p>
<pre><code> factory :attachment do
   supporting_documentation_file_name { 'test.pdf' }
   supporting_documentation_content_type { 'application/pdf' }
   supporting_documentation_file_size { 1024 }
   # ...
 end
</code></pre>
<p>&#8230;and all of our tests passed.</p>
<p>Conclusion: in model factories, set the Paperclip attributes directly and don&#8217;t use <code>fixture_file_upload</code>.</p>
<p>The post <a href="http://pivotallabs.com/avoid-using-fixture-file-upload-with-factorygirl-and-paperclip/">Avoid using fixture_file_upload with FactoryGirl and Paperclip</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/avoid-using-fixture-file-upload-with-factorygirl-and-paperclip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Friday Hugs!</title>
		<link>http://pivotallabs.com/friday-hugs/</link>
		<comments>http://pivotallabs.com/friday-hugs/#comments</comments>
		<pubDate>Fri, 14 Sep 2012 11:16:00 +0000</pubDate>
		<dc:creator>Desmond Bowe</dc:creator>
				<category><![CDATA[Standup]]></category>
		<category><![CDATA[agile]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/friday-hugs/</guid>
		<description><![CDATA[<p><h2>Events</h2>

<ul>
<li>Saturday: NYC PyLadies Meetup- 8PM</li>
</ul>

<p>http://www.meetup.com/NYC-PyLadies/</p>

<p>A group for Python ladies of all levels of programming experience, in the NYC metro area. </p>

<p>Pyladies is an international mentorship group with a focus on helping more women become active participants and leaders in the Python open-source community. Our mission is to promote, educate and advance a diverse Python community through outreach, education, conferences, events and social gatherings.</p>

<p>PyLadies also aims to provide a friendly support network for women and a bridge to the larger Python world. Anyone with an interest in Python is encouraged to participate!</p> <a href="http://pivotallabs.com/friday-hugs/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/friday-hugs/">Friday Hugs!</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<h2>Events</h2>
<ul>
<li>Saturday: NYC PyLadies Meetup- 8PM</li>
</ul>
<p>http://www.meetup.com/NYC-PyLadies/</p>
<p>A group for Python ladies of all levels of programming experience, in the NYC metro area. </p>
<p>Pyladies is an international mentorship group with a focus on helping more women become active participants and leaders in the Python open-source community. Our mission is to promote, educate and advance a diverse Python community through outreach, education, conferences, events and social gatherings.</p>
<p>PyLadies also aims to provide a friendly support network for women and a bridge to the larger Python world. Anyone with an interest in Python is encouraged to participate!</p>
<p>The post <a href="http://pivotallabs.com/friday-hugs/">Friday Hugs!</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/friday-hugs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Standup Ever!</title>
		<link>http://pivotallabs.com/best-standup-ever/</link>
		<comments>http://pivotallabs.com/best-standup-ever/#comments</comments>
		<pubDate>Thu, 13 Sep 2012 11:09:00 +0000</pubDate>
		<dc:creator>Desmond Bowe</dc:creator>
				<category><![CDATA[Standup]]></category>
		<category><![CDATA[agile]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/best-standup-ever/</guid>
		<description><![CDATA[<p><p>&#40;Title: 09/13/12: Best Standup Ever!&#41;</p>

<h2>Events</h2>

<ul>
<li>Thursday: NYC Lean Startup Meetup</li>
</ul>

<p>Q&#38;A with Eric Ries
Description: Eric Ries, the author of The Lean Startup, is in NYC and joining us to answer questions from the community.  We will be doing light moderation, but this event is really about you getting a chance to talk to Eric.</p> <a href="http://pivotallabs.com/best-standup-ever/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/best-standup-ever/">Best Standup Ever!</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>&#40;Title: 09/13/12: Best Standup Ever!&#41;</p>
<h2>Events</h2>
<ul>
<li>Thursday: NYC Lean Startup Meetup</li>
</ul>
<p>Q&amp;A with Eric Ries<br />
Description: Eric Ries, the author of The Lean Startup, is in NYC and joining us to answer questions from the community.  We will be doing light moderation, but this event is really about you getting a chance to talk to Eric.</p>
<p>The post <a href="http://pivotallabs.com/best-standup-ever/">Best Standup Ever!</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/best-standup-ever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>09/12/12: [NY][Standup] 9/12/2012 $0-$4 in Chrome</title>
		<link>http://pivotallabs.com/09-12-12-ny-standup-9-12-2012-0-4-in-chrome/</link>
		<comments>http://pivotallabs.com/09-12-12-ny-standup-9-12-2012-0-4-in-chrome/#comments</comments>
		<pubDate>Wed, 12 Sep 2012 11:15:00 +0000</pubDate>
		<dc:creator>Desmond Bowe</dc:creator>
				<category><![CDATA[Standup]]></category>
		<category><![CDATA[agile]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/09-12-12-ny-standup-9-12-2012-0-4-in-chrome/</guid>
		<description><![CDATA[<p><h2>Interestings</h2>

<ul>
<li>$0 - $4 in Chrome</li>
</ul>

<p>You can reference the 4 most recently selected elements from the Elements panel via these variables.</p>

<ul>
<li>Bundler.with_clean_env</li>
</ul>

<p>When you shell out from your ruby script and run the "bundle" command, it will bundle within the context of your script's Gemfile &#40;even if you cd first to another directory with a different Gemfile&#41;.</p>

<p>If you need to shell out and <code>bundle</code> outside the context of your script's bundle, use <code>Bundler.with_clean_env</code>. For example:</p>

<pre><code>Bundler.with_clean_env do
  `cd /some/other/bundled/project  &#38;&#38; bundle`
end
</code></pre>

<p>We ran into a need for this on LicenseFinder - we wrote an integration test suite that bootstraps a bundled project, adds dependencies with various licenses to it, then tests the output of license finder on the project.</p>

<h2>Events</h2>

<ul>
<li>Wednesday: Happy Programmers' Day! &#40;256th day of the year&#41;</li>
</ul>

<p>http://en.m.wikipedia.org/wiki/Programmers'_Day</p>

<ul>
<li>Wednesday: Junior Developer Panel Meetup &#40;or... How to Get Your First Coding Gig&#41;</li>
</ul>

<p>http://www.meetup.com/nyc-on-rails/events/79685082/</p>

<p>Are you someone teaching yourself to code, looking for your first job as a developer? This panel will address the questions of how to get your first job as a professional programmer, and what is expected of someone in that sort of role.  Questions from the audience are also welcome.  Our panelists:
Jeffrey Baird &#40;Junior Developer @ Medivo&#41;
Aidan Feldman &#40;Developer @ Jux &#38; Teacher @ NYU&#41; - moderator
Avi Flombaum &#40;Founder of Flatiron School&#41;
Pedro Ha &#40;Teacher @ NYU &#38; Developer @ CNBC&#41;
Dan Langevin &#40;CTO @ Lifebooker&#41;
Debbie Madden &#40;Exec. VP @ Cyrus Innovation&#41;
Beforehand, make sure to check out Jeffrey's great post on getting his job.  If you have other good resources around this topic, feel free to post in the comments.  We will do our best to record this, for those who can't make it. Note this event is not Rails-specific.  Drinks and snacks provided by Pivotal Labs.  Lastly, in an unusual meetup twist,recruiting [for junior developers] is welcome!</p> <a href="http://pivotallabs.com/09-12-12-ny-standup-9-12-2012-0-4-in-chrome/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/09-12-12-ny-standup-9-12-2012-0-4-in-chrome/">09/12/12: [NY][Standup] 9/12/2012 $0-$4 in Chrome</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<h2>Interestings</h2>
<ul>
<li>$0 &#8211; $4 in Chrome</li>
</ul>
<p>You can reference the 4 most recently selected elements from the Elements panel via these variables.</p>
<ul>
<li>Bundler.with_clean_env</li>
</ul>
<p>When you shell out from your ruby script and run the &#8220;bundle&#8221; command, it will bundle within the context of your script&#8217;s Gemfile &#40;even if you cd first to another directory with a different Gemfile&#41;.</p>
<p>If you need to shell out and <code>bundle</code> outside the context of your script&#8217;s bundle, use <code>Bundler.with_clean_env</code>. For example:</p>
<pre><code>Bundler.with_clean_env do
  `cd /some/other/bundled/project  &amp;&amp; bundle`
end
</code></pre>
<p>We ran into a need for this on LicenseFinder &#8211; we wrote an integration test suite that bootstraps a bundled project, adds dependencies with various licenses to it, then tests the output of license finder on the project.</p>
<h2>Events</h2>
<ul>
<li>Wednesday: Happy Programmers&#8217; Day! &#40;256th day of the year&#41;</li>
</ul>
<p>http://en.m.wikipedia.org/wiki/Programmers&#8217;_Day</p>
<ul>
<li>Wednesday: Junior Developer Panel Meetup &#40;or&#8230; How to Get Your First Coding Gig&#41;</li>
</ul>
<p>http://www.meetup.com/nyc-on-rails/events/79685082/</p>
<p>Are you someone teaching yourself to code, looking for your first job as a developer? This panel will address the questions of how to get your first job as a professional programmer, and what is expected of someone in that sort of role.  Questions from the audience are also welcome.  Our panelists:<br />
Jeffrey Baird &#40;Junior Developer @ Medivo&#41;<br />
Aidan Feldman &#40;Developer @ Jux &amp; Teacher @ NYU&#41; &#8211; moderator<br />
Avi Flombaum &#40;Founder of Flatiron School&#41;<br />
Pedro Ha &#40;Teacher @ NYU &amp; Developer @ CNBC&#41;<br />
Dan Langevin &#40;CTO @ Lifebooker&#41;<br />
Debbie Madden &#40;Exec. VP @ Cyrus Innovation&#41;<br />
Beforehand, make sure to check out Jeffrey&#8217;s great post on getting his job.  If you have other good resources around this topic, feel free to post in the comments.  We will do our best to record this, for those who can&#8217;t make it. Note this event is not Rails-specific.  Drinks and snacks provided by Pivotal Labs.  Lastly, in an unusual meetup twist,recruiting [for junior developers] is welcome!</p>
<p>The post <a href="http://pivotallabs.com/09-12-12-ny-standup-9-12-2012-0-4-in-chrome/">09/12/12: [NY][Standup] 9/12/2012 $0-$4 in Chrome</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/09-12-12-ny-standup-9-12-2012-0-4-in-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using apc
Database Caching using apc
Object Caching 632/697 objects using apc

 Served from: pivotallabs.com @ 2013-06-19 03:33:51 by W3 Total Cache -->