Skip to content
Permalink
Browse files

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

…its folder
  • Loading branch information...
kenmazaika committed Feb 22, 2012
1 parent 7e21d9a commit 287780f248cd0414515b2979765a8e1d4d69215d
Showing with 21 additions and 1 deletion.
  1. +1 −1 lib/turn/reporter.rb
  2. +20 −0 test/reporter_test.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
@@ -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.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.