Skip to content

Commit

Permalink
Make files ending with _test show up, even if they are in the test/un…
Browse files Browse the repository at this point in the history
…its folder
  • Loading branch information
metropolis-testman committed Feb 22, 2012
1 parent 7e21d9a commit 287780f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/turn/reporter.rb
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions 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

0 comments on commit 287780f

Please sign in to comment.