<?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>Pillage and Plunder &#187; autotest</title>
	<atom:link href="http://pillageandplunder.net/tag/autotest/feed/" rel="self" type="application/rss+xml" />
	<link>http://pillageandplunder.net</link>
	<description>Viking's programming blog</description>
	<lastBuildDate>Tue, 25 Aug 2009 00:21:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>View spec names and Autotest</title>
		<link>http://pillageandplunder.net/2008/12/view-spec-names-and-autotest/</link>
		<comments>http://pillageandplunder.net/2008/12/view-spec-names-and-autotest/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 23:05:59 +0000</pubDate>
		<dc:creator>viking</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[autotest]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://pillageandplunder.net/?p=24</guid>
		<description><![CDATA[In one of my Rails projects, I have some views that are rendered through ERB and others through HAML.  This makes it annoying to jump to a view&#8217;s spec via rails.vim, since it currently doesn&#8217;t handle custom Rcommand&#8217;s that accept multiple suffixes.
When I asked tpope today about this, he brought up a good point. [...]]]></description>
			<content:encoded><![CDATA[<p>In one of my Rails projects, I have some views that are rendered through ERB and others through HAML.  This makes it annoying to jump to a view&#8217;s spec via <a href="http://rails.vim.tpope.net">rails.vim</a>, since it currently doesn&#8217;t handle custom <code>Rcommand</code>&#8217;s that accept multiple suffixes.</p>
<p>When I asked <a href="http://tpope.net">tpope</a> today about this, he brought up a good point.  Why are view specs associated with an engine type (such as ERB or HAML) by default?  You should be able to convert an ERB view to a HAML view and use the same tests.</p>
<p>Per his tip, I renamed my views from names like <code>new.html.haml_spec.rb</code> to just <code>new.html_spec.rb</code>.  Unfortunately, autotest stopped recognizing the correlation between my views and my view specs.  Putting this in my <code>.autotest</code> file fixed the issue:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Autotest.<span style="color:#9900CC;">add_hook</span> <span style="color:#ff3333; font-weight:bold;">:initialize</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>at<span style="color:#006600; font-weight:bold;">|</span>
  at.<span style="color:#9900CC;">remove_mapping</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">%</span>^app<span style="color:#006600; font-weight:bold;">/</span>views<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">%</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  at.<span style="color:#9900CC;">add_mapping</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">%</span>^app<span style="color:#006600; font-weight:bold;">/</span>views<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">%</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f, md<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#008000; font-style:italic;"># strip off engine name</span>
    path = md<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">sub</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>\.<span style="color:#006600; font-weight:bold;">&#40;</span>erb<span style="color:#006600; font-weight:bold;">|</span>haml<span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">/</span>, <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    at.<span style="color:#9900CC;">files_matching</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">&#123;</span>spec<span style="color:#006600; font-weight:bold;">/</span>views<span style="color:#006600; font-weight:bold;">/</span><span style="color:#008000; font-style:italic;">#{path}_spec.rb})</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>I hope that helps someone. <img src='http://pillageandplunder.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://pillageandplunder.net/2008/12/view-spec-names-and-autotest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using autotest to test Ruby C extensions</title>
		<link>http://pillageandplunder.net/2008/11/using-autotest-to-test-ruby-c-extensions/</link>
		<comments>http://pillageandplunder.net/2008/11/using-autotest-to-test-ruby-c-extensions/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 23:45:02 +0000</pubDate>
		<dc:creator>viking</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[autotest]]></category>
		<category><![CDATA[rtp]]></category>

		<guid isPermaLink="false">http://pillageandplunder.net/?p=7</guid>
		<description><![CDATA[I recently decided to write a Ruby wrapper for the oRTP library so I can eventually implement a little RTSP server in Ruby.  I wanted to use autotest for my testing, but it didn&#8217;t work out of the box since I&#8217;m testing code that lives in the ext/ directory.  I wanted autotest to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently decided to write a Ruby wrapper for the <a href="http://www.linphone.org/index.php/eng/code_review/ortp">oRTP</a> library so I can eventually implement a little <a href="http://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol">RTSP</a> server in Ruby.  I wanted to use autotest for my testing, but it didn&#8217;t work out of the box since I&#8217;m testing code that lives in the <code>ext/</code> directory.  I wanted autotest to rebuild my extension after each change to the source file.  So I came up with an <code>.autotest</code> file that looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Autotest.<span style="color:#9900CC;">add_hook</span> <span style="color:#ff3333; font-weight:bold;">:run_command</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>at<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;Re-building extensions...&quot;</span>
  <span style="color:#CC00FF; font-weight:bold;">Dir</span>.<span style="color:#9900CC;">chdir</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/ext&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#996600;">`make`</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
Autotest.<span style="color:#9900CC;">add_hook</span> <span style="color:#ff3333; font-weight:bold;">:initialize</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>at<span style="color:#006600; font-weight:bold;">|</span>
  at.<span style="color:#9900CC;">add_mapping</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">&#123;</span>^ext<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>\w<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>\.<span style="color:#9900CC;">c</span>$<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f, md<span style="color:#006600; font-weight:bold;">|</span>
    at.<span style="color:#9900CC;">files_matching</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">&#123;</span>test<span style="color:#006600; font-weight:bold;">/</span>test_<span style="color:#008000; font-style:italic;">#{md[1]}.rb})</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The beginnings of my code for this project is on <a href="http://github.com/viking/ruby-rtp">teh Githubz</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://pillageandplunder.net/2008/11/using-autotest-to-test-ruby-c-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
