diff --git a/CHANGES b/CHANGES index df8a99bbc..8cff80169 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ * Disable color codes on STDOUT when STDOUT.tty? is false (patch from Tim Pope). Closes #413. * mock(:null_object=>true) plays nice with HTML (patch from Gerrit Kaiser). Closes #230. * a step definition with no block is treated as pending +* make sure consolidate_failures only grabs _spec files. Closes #369 == Version 1.1.4 diff --git a/lib/autotest/rspec.rb b/lib/autotest/rspec.rb index 164f298f5..f27968c2e 100644 --- a/lib/autotest/rspec.rb +++ b/lib/autotest/rspec.rb @@ -28,7 +28,7 @@ def initialize def consolidate_failures(failed) filters = new_hash_of_arrays failed.each do |spec, trace| - if trace =~ /\n(\.\/)?(.*\.rb):[\d]+:\Z?/ + if trace =~ /\n(\.\/)?(.*spec\.rb):[\d]+:\Z?/ filters[$2] << spec end end diff --git a/spec/autotest/rspec_spec.rb b/spec/autotest/rspec_spec.rb index 3abe3fdd5..bfd636c5b 100644 --- a/spec/autotest/rspec_spec.rb +++ b/spec/autotest/rspec_spec.rb @@ -171,7 +171,7 @@ def common_setup common_setup @rspec_autotest = Rspec.new - @spec_file = "spec/autotest/rspec_spec.rb" + @spec_file = "spec/autotest/some_spec.rb" @rspec_autotest.instance_variable_set("@files", {@spec_file => Time.now}) @rspec_autotest.stub!(:find_files_to_test).and_return true end @@ -181,7 +181,7 @@ def common_setup end it "should return a hash with the spec filename => spec name for each failure or error" do - @rspec_autotest.stub!(:test_files_for).and_return "spec/autotest/rspec_spec.rb" + @rspec_autotest.stub!(:test_files_for).and_return "spec/autotest/some_spec.rb" failures = [ [ "false should be false", @@ -193,5 +193,17 @@ def common_setup } end + it "should not include the subject file" do + subject_file = "lib/autotest/some.rb" + @rspec_autotest.stub!(:test_files_for).and_return "spec/autotest/some_spec.rb" + failures = [ + [ + "false should be false", + "expected: true,\n got: false (using ==)\n#{subject_file}:143:\n#{@spec_file}:203:" + ] + ] + @rspec_autotest.consolidate_failures(failures).keys.should_not include(subject_file) + end + end end