Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
make sure consolidate_failures only grabs _spec files. Closes #369
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Jun 4, 2008
1 parent 3b76fda commit 2b474ac
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/autotest/rspec.rb
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions spec/autotest/rspec_spec.rb
Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -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

2 comments on commit 2b474ac

@genki
Copy link

@genki genki commented on 2b474ac Jul 6, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@davidwparker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was exactly what I was looking for, thanks!

Please sign in to comment.