<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>bin/merb-specs</filename>
    </added>
    <added>
      <filename>lib/merb-core/test/run_specs.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -18,6 +18,7 @@ include FileUtils
 NAME = &quot;merb-core&quot;
 
 require &quot;lib/merb-core/version&quot;
+require &quot;lib/merb-core/test/run_specs&quot;
 
 ##############################################################################
 # Packaging &amp; Installation
@@ -126,37 +127,6 @@ task :aok =&gt; [:specs, :rcov]
 #   t.spec_files = Dir[&quot;spec/**/*_spec.rb&quot;].sort
 # end
 
-require 'open3'
-
-def run_specs(glob, spec_cmd='spec')
-  require &quot;optparse&quot;
-  require &quot;spec&quot;
-  examples, failures, errors, pending = 0, 0, 0, 0
-  Dir[glob].each do |spec|
-    response = Open3.popen3(&quot;#{spec_cmd} #{File.expand_path(spec)} -f s -c&quot;) do |i,o,e|
-      while out = o.gets
-        STDOUT.puts out
-        STDOUT.flush
-        if out =~ /\d+ example/
-          e, f, p = out.match(/(\d+) examples?, (\d+) failures?(?:, (\d+) pending?)?/)[1..-1]
-          examples += e.to_i; failures += f.to_i; pending += p.to_i          
-        end
-      end
-      errors += 1 if e.is_a?(IO)
-      STDOUT.puts e.read if e.is_a?(IO)
-    end
-  end
-  puts
-  puts &quot;*** TOTALS ***&quot;
-  if failures == 0
-    print &quot;\e[32m&quot;
-  else
-    print &quot;\e[31m&quot;
-  end
-  puts &quot;#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending&quot;
-  print &quot;\e[0m&quot;  
-end
-
 def setup_specs(name, spec_cmd='spec')
   desc &quot;Run all specs (#{name})&quot;
   task &quot;specs:#{name}&quot; do</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -22,28 +22,28 @@ class RspecCommandError &lt; StandardError; end
 class Autotest::MerbsourceRspec &lt; Autotest
   
   Autotest.add_hook :initialize do |at|
-    %w{.git}.each {|exception| at.exceptions.push exception}
-  end
-  
-  Autotest.add_hook :run do |at|
+    at.clear_mappings
+    at.add_exception(/\.git/)
+
     # See above for human-readable descriptions of these rules
-      # 1 above
-      at.add_mapping(%r{^spec/.*_spec\.rb$}) { |filename, _| filename}
+    # 1 above
+    at.add_mapping(%r{^spec/.*_spec\.rb$}) { |filename, _| filename}
 
-      # 2 above
-      at.add_mapping(%r{^spec/(.*)/spec_helper\.rb$}) { |_, m| at.files_matching %r{^spec/#{m[1]}/.*_spec\.rb$} }
+    # 2 above
+    at.add_mapping(%r{^spec/spec_helper\.rb$}) { |_, m| at.files_matching %r{^spec/.*_spec\.rb$} }
+    at.add_mapping(%r{^spec/(.*)/spec_helper\.rb$}) { |_, m| at.files_matching %r{^spec/#{m[1]}/.*_spec\.rb$} }
 
-      # 3 above
-      at.add_mapping(%r{^lib/merb-core/controller/([^/]*)\.rb$}) { |_, m| at.files_matching %r{^spec\/(public|private)\/#{m[1]}\/.*_spec\.rb} }
+    # 3 above
+    at.add_mapping(%r{^lib/merb-core/controller/([^/]*)\.rb$}) { |_, m| at.files_matching %r{^spec/(public|private)/abstract_controller/.*_spec\.rb} }
 
-      # 4 above
-      at.add_mapping(%r{^lib/merb-core/controller/mixins/([^/]*)\.rb$}) { |_, m| at.files_matching %r{^spec/(public|private)/(abstract_)?controller/#{m[1]}_spec\.rb} }
+    # 4 above
+    at.add_mapping(%r{^lib/merb-core/controller/mixins/([^/]*)\.rb$}) { |_, m| at.files_matching %r{^spec/(public|private)/(abstract_)?controller/#{m[1]}_spec\.rb} }
 
-      # 5 above
-      at.add_mapping(%r{^lib/merb-core/([^/]*)\.rb$}) { |_, m| at.files_matching %r{^spec/(public|private)/#{m[1]}/.*_spec\.rb} }
+    # 5 above
+    at.add_mapping(%r{^lib/merb-core/([^/]*)\.rb$}) { |_, m| at.files_matching %r{^spec/(public|private)/#{m[1]}/.*_spec\.rb} }
 
-      # 6 above
-      at.add_mapping(%r{^lib/merb\.rb$}) { at.files_matching %r{^spec/[^/]*_spec\.rb$} }
+    # 6 above
+    at.add_mapping(%r{^lib/merb\.rb$}) { at.files_matching %r{^spec/[^/]*_spec\.rb$} }
 
   end
 
@@ -57,12 +57,6 @@ class Autotest::MerbsourceRspec &lt; Autotest
   
   attr_accessor :failures
 
-  def tests_for_file(filename)
-    super.select { |f| @files.has_key? f }
-  end
-  
-  alias :specs_for_file :tests_for_file
-
   def failed_results(results)
     results.scan(/^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m)
   end
@@ -83,7 +77,7 @@ class Autotest::MerbsourceRspec &lt; Autotest
   def consolidate_failures(failed)
     filters = Hash.new { |h,k| h[k] = [] }
     failed.each do |spec, failed_trace|
-      @files.keys.select { |f| f =~ /spec\// }.each do |f|
+      find_files.keys.select { |f| f =~ /spec\// }.each do |f|
         if failed_trace =~ Regexp.new(f)
           filters[f] &lt;&lt; spec
           break
@@ -98,7 +92,7 @@ class Autotest::MerbsourceRspec &lt; Autotest
   end
 
   def test_cmd_options
-    '-O specs/spec.opts' if File.exist?('specs/spec.opts')
+    # '-O specs/spec.opts' if File.exist?('specs/spec.opts')
   end
   
   # Finds the proper spec command to use.  Precendence
@@ -113,16 +107,8 @@ class Autotest::MerbsourceRspec &lt; Autotest
     end
   end
   
-  # Autotest will look for spec commands in the following
-  # locations, in this order:
-  #
-  #   * bin/spec
-  #   * default spec bin/loader installed in Rubygems
+  # Merb specs must be run 1 at a time, so use our special runner
   def spec_commands
-    if (spec = `which spec`.chomp) &amp;&amp; !spec.empty?
-      return [spec]
-    end
-    [File.join('bin', 'spec'),
-     File.join(Config::CONFIG['bindir'], 'spec')]
+    [File.join('bin', 'merb-specs')]
   end
 end
\ No newline at end of file</diff>
      <filename>autotest/merbsource_rspec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ff6e1a92e276b04529e7cea4ceb97c5ced4246aa</id>
    </parent>
  </parents>
  <author>
    <name>Michael D. Ivey</name>
    <email>ivey@gweezlebur.com</email>
  </author>
  <url>http://github.com/wycats/merb-core/commit/0b7f94a35d25057b7cccd593cea3abaae3efa72a</url>
  <id>0b7f94a35d25057b7cccd593cea3abaae3efa72a</id>
  <committed-date>2008-02-29T08:57:47-08:00</committed-date>
  <authored-date>2008-02-29T08:57:47-08:00</authored-date>
  <message>get autotest working for merb-core

Extracted run_specs from Rakefile into lib/merb-core/test/run_specs.rb,
and call that from bin/merb-specs

Specs now run individually, as designed.

autotest still chokes up and runs the failing specs 8 or 9 times in rapid
succession, but that's a bug we can live with for the time being.</message>
  <tree>e95572c74de4199533828dc3509fa7e6f0ef1c8a</tree>
  <committer>
    <name>Michael D. Ivey</name>
    <email>ivey@gweezlebur.com</email>
  </committer>
</commit>
