<?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>catapult-creative.com &#187; RSpec</title>
	<atom:link href="http://www.catapult-creative.com/tag/rspec/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.catapult-creative.com</link>
	<description>worldwide (web) whatnot</description>
	<lastBuildDate>Fri, 17 Jun 2011 00:45:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Profile your Rails RSpec and find your slow tests fast</title>
		<link>http://www.catapult-creative.com/2008/07/18/profile-your-rails-rspec-and-find-your-slow-tests-fast/</link>
		<comments>http://www.catapult-creative.com/2008/07/18/profile-your-rails-rspec-and-find-your-slow-tests-fast/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 17:08:00 +0000</pubDate>
		<dc:creator>Trevor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CodeDunce]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[remember-tip]]></category>
		<category><![CDATA[RSpec]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">tag:www.catapult-creative.com,2008-07-18:69</guid>
		<description><![CDATA[Long-as-hell Ruby on Rails RSpec test running times are making you ask &#8220;what the deuce?&#8221;  Specs are taking way too long to run, but the prospect of looking through them all one at a time to find offending external dependencies, net calls that should be mocked, etc is driving you to drink. You just [...]]]></description>
			<content:encoded><![CDATA[<p>Long-as-hell Ruby on Rails RSpec test running times are making you ask &#8220;what the deuce?&#8221;  Specs are taking way too long to run, but the prospect of looking through them all one at a time to find offending external dependencies, net calls that should be mocked, etc is driving you to drink. You just want a read-out of the tests that are taking the longest so you can refactor <span class="caps">ASAP.</span></p>

<p>Sound familiar?</p>

<p>I was in this boat until I found out about the profiling command:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">$&gt;spec spec -f profile</div></td></tr></tbody></table></div>

<p>The double &#8220;spec&#8221; here can be a bit confusing.  The first is the command, and the second is the directory (RAILS_ROOT/spec) that you&#8217;re running it on.  The -f is the format flag.  You can see a list of all formats with:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">$&gt;spec --help</div></td></tr></tbody></table></div>

<p>Basically you&#8217;re just passing the &#8220;profile&#8221; argument to the formatting command.  It gives you a readout of the 10 most time-intensive specs at the top and then a nicely verbose list of all pending and failed tests.  Using this list, I was able to go straight to the most obnoxious offenders and eliminate the external dependencies (these specs happened to be fetching feeds) that were slowing my test suite down.  In less than 15 minutes, I had chopped my execution time down to 10% of what it was before I started.</p>

<p>Huzzah!</p>]]></content:encoded>
			<wfw:commentRss>http://www.catapult-creative.com/2008/07/18/profile-your-rails-rspec-and-find-your-slow-tests-fast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

