[rspec-users] rspec_autotest no longer re-runs tests with rspec 0.7.5

Michael Johnston lastobelus at mac.com
Mon Jan 1 21:46:47 EST 2007


Ok I just took the time to figure this out. It should have been  
obvious to me: turning on redgreen breaks the regex in  
"handle_results" which should create an array of failed tests because  
the color codes that are added to the result string.

I discovered it was also mildly broken without color, because the  
second term in the regex needs to be made non greedy, or it matches  
everything after the first error. But because of the way this is  
used, I don't think this would make much (any) difference to the  
functioning of autotest.

Anyway, so here is the diff with the regex for handle_results  
function of rspec_autotest that works with redgreen turned on (and  
with spec command changed to use the rails_spec_server):

Index: lib/rspec_autotest.rb
===================================================================
--- lib/rspec_autotest.rb       (revision 45)
+++ lib/rspec_autotest.rb       (working copy)
@@ -26,7 +26,7 @@
    attr_accessor :spec_command
    def initialize # :nodoc:
-    @spec_command = "spec --diff unified"
+    @spec_command = "script/rails_spec -C --diff unified"
      super
      @exceptions = %r%^\./(?:coverage|db|doc|log|public|script|vendor)%
    end
@@ -76,7 +76,7 @@
    end
    def handle_results(results)
-    failed = results.scan(/^\d+\)\n(?:.*?Error in )?'([^']*?)'(?:  
FAILED)?\n(.*)\n\n/m)
+    failed = results.scan(/^\d+\)\n(?:\e\[\d*m)?(?:.*?Error  
in )?'([^']*?)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m)
      @files_to_test = consolidate_failures failed
      unless @files_to_test.empty? then
        hook :red




On 30-Dec-06, at 4:46 AM, Michael Johnston wrote:

> That is what I meant. In my setup, it is NOT rerunning the whole  
> suite after I fix a failing spec.
>
> After a cursory look  at autotest.rb in ZenTest, I haven't figured  
> out why it is broken. But I think I will try to figure that out  
> today, because autotest seems kind of pointless without that  
> behaviour.
>
> It probably has nothing to do with rspec or rspec_autotest; I  
> realized that my version of ZenTest is new too, 3.4.3 instead of  
> 3.4.1.
>
> Cheers,
> Michael
> On 21-Dec-06, at 11:13 AM, Nick Sieger wrote:
>
>> On 12/21/06, Michael Johnston <lastobelus at mac.com> wrote:
>> Has anyone else encountered this problem?
>>
>> What I mean is, rspec_autotest runs all specs, then waits. When you
>> change a spec, it reruns that spec. However, if that spec now passes,
>> it should run the whole suite again, so you can see the next one to
>> work on. It no longer does this. This renders it somewhat useless.
>>
>> Does anyone have autotest working with rspec 0.7.5, or does anyone
>> have any idea of what may be causing this issue or how to go about
>> fixing it?
>>
>> Are you sure this is caused by the 0.7.5 upgrade?  I've seen  
>> similar behavior but I'm still on 0.7.3.  Here's the response  
>> comment I posted to yours:
>>
>> I think this is expected behavior for autotest – I've already  
>> noticed this and assumed it was standard behavior. The only time  
>> autotest reruns the whole suite is after I've just fixed a failing  
>> test or spec. Is it possible that's what you're observing?
>>
>> Feel free to take any further discussion off-list, thanks.
>>
>> /Nick
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070101/f0575b74/attachment.html 


More information about the rspec-users mailing list