Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make files ending with _test show up, even if they are in the test/un…

…its folder
  • Loading branch information...
commit 287780f248cd0414515b2979765a8e1d4d69215d 1 parent 7e21d9a
@kenmazaika kenmazaika authored
Showing with 21 additions and 1 deletion.
  1. +1 −1  lib/turn/reporter.rb
  2. +20 −0 test/reporter_test.rb
View
2  lib/turn/reporter.rb
@@ -77,7 +77,7 @@ def clean_backtrace(backtrace)
/\/lib\/turn.*\.rb/,
/\/bin\/turn/,
/\/lib\/minitest.*\.rb/,
- /\/test\/unit.*\.rb/
+ /\/test\/unit\/(?!.*\_test.rb).*\.rb.*/
])
# Filter backtrace of unimportant entries, and applies count limit if set in
View
20 test/reporter_test.rb
@@ -0,0 +1,20 @@
+require File.expand_path(File.dirname(__FILE__)) + '/helper.rb'
+require File.expand_path(File.dirname(__FILE__) + '/..') + '/lib/turn/reporter'
+
+class TestReporter < Turn::Reporter
+end
+
+class TestReporters < Test::Unit::TestCase
+ def test_unit_test_files_are_filtered_but_project_files_are_not
+ reporter = TestReporter.new(nil)
+
+ # If you follow the convention of naming your test files with _test.rb, do not filter that
+ # test file from the stack trace
+ filtered_lines = ["/Users/testman/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit/assertions.rb:185:in `assert_equal'"]
+ unfiltered_lines = ["/Users/testman/source/campaign_manager/test/unit/omg_test.rb:145:in `block in <class:OmgTest>'",
+ "/Users/testman/source/campaign_manager/app/models/omg.rb:145:in `in double_rainbows'" ]
+ stack_trace = filtered_lines + unfiltered_lines
+
+ assert_equal unfiltered_lines, reporter.send(:filter_backtrace, stack_trace)
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.