lib/autotest/rspec.rb in rspec-1.1.3 vs lib/autotest/rspec.rb in rspec-1.1.4

- old
+ new

@@ -19,30 +19,28 @@ class Autotest::Rspec < Autotest def initialize super - self.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m - self.completed_re = /\Z/ # FIX: some sort of summary line at the end? + self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m end - + def consolidate_failures(failed) - filters = Hash.new { |h,k| h[k] = [] } - failed.each do |spec, failed_trace| - if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } then - filters[f] << spec - break + filters = new_hash_of_arrays + failed.each do |spec, trace| + if trace =~ /\n(\.\/)?(.*\.rb):[\d]+:\Z?/ + filters[$2] << spec end end return filters end def make_test_cmd(files_to_test) return "#{ruby} -S #{spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}" end - def add_options_if_present + def add_options_if_present # :nodoc: File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : "" end # Finds the proper spec command to use. Precendence is set in the # lazily-evaluated method spec_commands. Alias + Override that in