<?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>rel=me &#187; testing</title>
	<atom:link href="http://rel.me/t/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://rel.me</link>
	<description>programming, objective-c, cocoa, iphone, c</description>
	<lastBuildDate>Wed, 01 Feb 2012 07:26:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rake test task for a custom FileList</title>
		<link>http://rel.me/2007/04/06/rake-test-task-for-a-custom-filelist/</link>
		<comments>http://rel.me/2007/04/06/rake-test-task-for-a-custom-filelist/#comments</comments>
		<pubDate>Fri, 06 Apr 2007 03:32:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Rake]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">/2007/09/03/rake-test-task-for-a-custom-filelist</guid>
		<description><![CDATA[I work on a very large rails project, and rake test has become unruly mostly due to the size of our codebase. Anyway, I wrote this task to run only the tests in the products/namespace I work on. rake test:products PRODUCTS=product1,product2 Runs all unit tests in test/**/product1/*test*.rb, test/**/product2/*test*.rb The task: 1 2 3 4 5 [...]]]></description>
			<content:encoded><![CDATA[<p>I work on a very large rails project, and rake test has become unruly mostly due to the size of our codebase. Anyway, I wrote this task to run only the tests in the products/namespace I work on.</p>
<pre>
rake test:products PRODUCTS=product1,product2
</pre>
<p>Runs all unit tests in test/**/product1/*test*.rb, test/**/product2/*test*.rb</p>
<p>The task:</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt>5<tt>
</tt>6<tt>
</tt>7<tt>
</tt>8<tt>
</tt>9<tt>
</tt><strong>10</strong><tt>
</tt>11<tt>
</tt>12<tt>
</tt>13<tt>
</tt>14<tt>
</tt>15<tt>
</tt>16<tt>
</tt>17<tt>
</tt>18<tt>
</tt>19<tt>
</tt><strong>20</strong><tt>
</tt>21<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">namespace <span class="sy">:test</span> <span class="r">do</span><tt>
</tt>  task <span class="sy">:products</span> <span class="r">do</span>      <tt>
</tt>    raise <span class="s"><span class="dl">&quot;</span><span class="k">Usage: rake test:products PRODUCTS=product1,product2</span><span class="dl">&quot;</span></span> <span class="r">if</span> <span class="co">ENV</span>[<span class="s"><span class="dl">'</span><span class="k">PRODUCTS</span><span class="dl">'</span></span>].blank?<tt>
</tt>    <tt>
</tt>    products = <span class="co">ENV</span>[<span class="s"><span class="dl">'</span><span class="k">PRODUCTS</span><span class="dl">'</span></span>].split(<span class="rx"><span class="dl">/</span><span class="k">,</span><span class="dl">/</span></span>)<tt>
</tt>    files = []<tt>
</tt>    <tt>
</tt>    products.each <span class="r">do</span> |product|<tt>
</tt>      dir = <span class="s"><span class="dl">&quot;</span><span class="il"><span class="idl">#{</span><span class="co">RAILS_ROOT</span><span class="idl">}</span></span><span class="k">/test/**/</span><span class="il"><span class="idl">#{</span>product<span class="idl">}</span></span><span class="dl">&quot;</span></span><tt>
</tt>      files += <span class="co">FileList</span>[<span class="s"><span class="dl">&quot;</span><span class="il"><span class="idl">#{</span>dir<span class="idl">}</span></span><span class="k">/*test*.rb</span><span class="dl">&quot;</span></span>]<tt>
</tt>    <span class="r">end</span>    <tt>
</tt>    <tt>
</tt>    test_task = <span class="co">Rake</span>::<span class="co">TestTask</span>.new(<span class="s"><span class="dl">&quot;</span><span class="k">test_products</span><span class="dl">&quot;</span></span>) <span class="r">do</span> |t|<tt>
</tt>      t.libs &lt;&lt; <span class="s"><span class="dl">&quot;</span><span class="k">test</span><span class="dl">&quot;</span></span><tt>
</tt>      t.test_files = files<tt>
</tt>      t.verbose = <span class="pc">true</span><tt>
</tt>    <span class="r">end</span><tt>
</tt>    <tt>
</tt>    task(<span class="s"><span class="dl">&quot;</span><span class="k">test_products</span><span class="dl">&quot;</span></span>).execute           <tt>
</tt>  <span class="r">end</span><tt>
</tt><span class="r">end</span></pre>
</td>
</tr>
</table>
<p>There is probably an easier way, but this works for me. Also I wouldn&#8217;t mind someone patching rake to accept opts style arguments, like &#8211;opt=blah, or -o blah. The ENV stuff seems really not so friendly.</p>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2007/04/06/rake-test-task-for-a-custom-filelist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

