Nick Sieger: Auto RSpectag:blog.nicksieger.com,2005:TypoTypo2007-08-31T17:25:48+00:00Nickurn:uuid:4774f059-a232-402b-9c6b-42e642faa79c2006-11-14T17:28:38+00:002007-08-31T17:25:48+00:00Comment on Auto RSpec by Nick<p>Ah, the issue looks like the change of the <code>--diff</code> argument to spec. Can you try the most recent code in svn and let me know if it works for you? Post updated with new links to <a href='http://svn.caldersphere.net/svn/main/rspec_autotest/trunk' rel="nofollow">http://svn.caldersphere.net/svn/main/rspec_autotest/trunk</a></p>Nickurn:uuid:b5a1d46f-de76-4f22-837a-731c8b4d2e032006-11-14T16:10:04+00:002007-08-31T17:25:47+00:00Comment on Auto RSpec by Nick<p>Can one of you guys file a report of some sort at <a href='http://trac.caldersphere.net/projects/main/newticket' rel="nofollow">http://trac.caldersphere.net/projects/main/newticket</a> ?</p>
<p>Thanks!</p>Piusurn:uuid:9706c938-5272-4c91-95a3-f3486ab44b912006-11-12T23:33:15+00:002007-08-31T17:25:47+00:00Comment on Auto RSpec by Pius<p>This looks really sweet! I’m having the same issue as meekish though, using ZenTest 3.4.1 and RSpec 0.7.2.</p>Nickurn:uuid:4badffa4-c182-4f8a-940d-11957742f9f42006-11-08T16:38:31+00:002007-08-31T17:25:46+00:00Comment on Auto RSpec by Nick<p>I haven’t seen that error before, could you provide the full command line that autotest is invoking? Also, which versions of RSpec and ZenTest?</p>meekishurn:uuid:ced881dd-3137-4915-afca-50b798308f882006-11-08T07:53:03+00:002007-08-31T17:25:46+00:00Comment on Auto RSpec by meekish<p>I’m getting this error when running rake spec:autotest </p>
<p>Couldn’t find differ class spec/models/product_spec.rb
Make sure the –require option is specified <em>before</em> –diff</p>
<p>Do you know what would cause it?</p>Nickurn:uuid:63cbdf6b-41a2-40a2-90be-2bffbdaacf722006-09-15T14:25:11+00:002007-08-31T17:25:46+00:00Comment on Auto RSpec by Nick<p>Please do, I was hoping you’d take notice and make autotest more extensible as a result. I realize now that I put it out there w/o a copyright notice, so I’ll relinquish it to you as long as you give me an attribution for it. Thanks!</p>zenspiderurn:uuid:b195b3cd-de1b-43d4-a66d-99b78918f2f72006-09-14T21:00:03+00:002007-08-31T17:25:45+00:00Comment on Auto RSpec by zenspider<p>May I steal this?</p>Joshurn:uuid:dc51d895-2bed-4dcb-b71f-77114ab82fcc2006-09-14T09:36:35+00:002007-08-31T17:25:45+00:00Comment on Auto RSpec by Josh<p>Nice!</p>Nick Siegerurn:uuid:52bf2e58-ea0e-4473-bad5-c7b42775bfee2006-09-13T20:35:00+00:002007-08-31T17:25:45+00:00Auto RSpec<p><em>Update: (2 months later) If you’re reading this, you’re probably interested in <a href="/articles/2006/11/15/rspec-autotest-now-a-rails-plugin">my Rails plugin for this</a> instead.</em></p>
<p>Hot off the presses, after a few hours of hacking and tweaking, may I present Auto+RSpec, otherwise known as The Mashup of <a href="http://rspec.rubyforge.org/tools/rails.html">RSpec on Rails</a> and <a href="http://www.zenspider.com/ZSS/Products/ZenTest/">autotest</a>. This is not an official release of any sort, but “may work for you.” It’s not a clean hack, as it exposes some areas for autotest to grow if the maintainers decide to open it up to alternatives to Test::Unit. After spending a little time looking at the autotest code, I think it would be nice to allow hooks for autotest plugins to define project conventions (i.e., <code>@exceptions</code> and the <code>#tests_for_file</code> method) as well as a result parsing API.</p>
<p>For now, if you’re an RSpec on Rails user, you can try this out as follows:</p>
<ul>
<li>Install <a href="http://www.zenspider.com/ZSS/Products/ZenTest/">ZenTest</a> if you haven’t already: <code>sudo gem install ZenTest</code>.</li>
<li>Download <a href="http://svn.caldersphere.net/svn/main/rspec_autotest/trunk/lib/rspec_autotest.rb">rspec_autotest.rb</a> and put in your <code>vendor/plugins/rspec/lib</code> directory (you did say you’re using RSpec on Rails didn’t you?)</li>
<li>Download <a href="http://svn.caldersphere.net/svn/main/rspec_autotest/trunk/tasks/rspec_autotest.rake">rspec_autotest.rake</a> and put in your <code>lib/tasks</code> directory</li>
<li>Start <code>autotest</code> with rake by typing <code>rake spec:autotest</code></li>
<li>Note: if you’re using RSpec 0.6, you might have better success with <a href="http://svn.caldersphere.net/svn/main/rspec_autotest/tags/rspec-0.6.0">the files located here</a>.</li>
</ul>
<p>Next steps for this will be to work out whether this code should live in RSpec on Rails or autotest, or some combination of those.</p>
<p>Now, spec’ers, be off in search of that <strong>Red/Green/Refactor</strong> rhythm of which sage agilists speak!</p>
<p><strong>Bonus tip</strong>: add the following code to your <code>.autotest</code> file to run <code>spec</code> with <code>rcov</code>:</p>
<div class="typocode"><pre><code class="typocode_ruby "> <span class="constant">Autotest</span><span class="punct">.</span><span class="ident">add_hook</span> <span class="symbol">:initialize</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">at</span><span class="punct">|</span>
<span class="comment"># run spec with rcov</span>
<span class="keyword">if</span> <span class="ident">at</span><span class="punct">.</span><span class="ident">respond_to?</span> <span class="symbol">:spec_command</span>
<span class="ident">at</span><span class="punct">.</span><span class="ident">spec_command</span> <span class="punct">=</span> <span class="punct">%{</span><span class="string">rcov --exclude "lib/spec/.*" -Ilib --rails "/usr/lib/ruby/gems/1.8/gems/rspec-0.6.0/bin/spec" -- --diff</span><span class="punct">}</span>
<span class="keyword">end</span>
<span class="keyword">end</span></code></pre></div>