<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Robby on Rails: The Zen of Auto Rspec</title>
    <link>http://www.robbyonrails.com/articles/2007/01/10/the-zen-of-auto-rspec</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>thoughts.sort_by{|t| t[:topic]}.collect </description>
    <item>
      <title>The Zen of Auto Rspec</title>
      <description>&lt;p&gt;Several months ago, I heard that people were using a program called &lt;a href="http://nubyonrails.com/articles/2006/04/19/autotest-rails"&gt;autotest&lt;/a&gt; to have their tests continue to run as you made changes to your code base, which comes with &lt;a href="http://zentest.rubyforge.org/ZenTest/"&gt;ZenTest&lt;/a&gt;. It&amp;#8217;s a really nice tool written by Ryan Davis and I hadn&amp;#8217;t gotten a chance to play with it as of yet. Well, our team isn&amp;#8217;t spending too much time in the &lt;code&gt;test/&lt;/code&gt; directory these days as we jumped ship near the end of last summer and found ourselves hanging out on the &lt;a href="http://blog.brightredglow.com/2006/10/4/what-s-it-worth-to-me"&gt;Isle of &lt;span class="caps"&gt;BDD&lt;/span&gt;&lt;/a&gt;. The locals are &lt;a href="http://blog.daveastels.com/articles/2005/07/05/a-new-look-at-test-driven-development"&gt;quite thoughtful&lt;/a&gt; about these sorts of things.&lt;/p&gt;


	&lt;p&gt;I just started working on a project that has been under development for several months and as I&amp;#8217;m getting to learn the ins/outs of the system, I find myself having to rerun the specs, which can take quite a bit of time watching. Watching your specs or tests run sometimes is as productive as watching your code compile. Oddly enough, this is as close to compilation as we really get when working with Ruby on Rails&amp;#8230; and it&amp;#8217;s a productivity killer for me.&lt;/p&gt;


	&lt;h2&gt;There Must Be a Better Way!&lt;/h2&gt;


	&lt;p&gt;So, I did a quick google search and found &lt;a href="http://blog.nicksieger.com/articles/2006/11/15/rspec-autotest-now-a-rails-plugin"&gt;an announcement&lt;/a&gt; for Rails that ran specs through ZenTest. This was exactly what I was searching for!&lt;/p&gt;


	&lt;h3&gt;Some requirements&lt;/h3&gt;


	&lt;p&gt;Please makes sure that you have the following gems installed in your development environment as they are dependencies to make this all work.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;zentest &lt;/li&gt;
		&lt;li&gt;diff-lcs&lt;/li&gt;
	&lt;/ul&gt;


&lt;pre&gt;&lt;code&gt;
$ sudo gem install zentest diff-lcs 
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;note&lt;/strong&gt; I&amp;#8217;m going to assume that you have rspec and rspec for rails installed&amp;#8230; if not&amp;#8230; tsk. ;-)&lt;/p&gt;


	&lt;h3&gt;Install RSpec autotest&lt;/h3&gt;


&lt;pre&gt;&lt;code&gt;
$ script/plugin install http://svn.caldersphere.net/svn/main/plugins/rspec_autotest
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;If you&amp;#8217;re using subversion, you might consider installing it as an external.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
$ script/plugin install -x http://svn.caldersphere.net/svn/main/plugins/rspec_autotest
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Running  RSpec autotest&lt;/h3&gt;


	&lt;p&gt;This is where it gets tricky. ;-)&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
$ rake spec:autotest
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Now, you can keep a terminal window open and autotest will watch your application and detect when files change. When they change, it&amp;#8217;ll attempt to rerun your specs (specifically those that changed). This helps save you the time of having to rerun all your specs throughout the development process and keep your spec:all sanity checks for when you&amp;#8217;re about to commit code to your repository.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ll post another entry in the next few days to show you how you can use &lt;a href="http://growl.info/"&gt;Growl&lt;/a&gt; with RSpec Autotest to keep you from having to look at your terminal all the time.&lt;/p&gt;


	&lt;p&gt;Until then&amp;#8230; have fun!&lt;/p&gt;
</description>
      <pubDate>Wed, 10 Jan 2007 11:08:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:dfc3e9d1-5548-4a55-a66b-9e36b6a07580</guid>
      <author>Robby Russell</author>
      <link>http://www.robbyonrails.com/articles/2007/01/10/the-zen-of-auto-rspec</link>
      <category>Ruby on Rails</category>
      <category>Ruby</category>
      <category>Programming</category>
      <category>bdd</category>
      <category>rspec</category>
      <category>autotest</category>
      <category>rake</category>
      <category>subversion</category>
      <category>productivity</category>
      <category>development</category>
    </item>
  </channel>
</rss>
