Skip to content
Permalink
Browse files

Make files begining with test_ show up, even if they are in the test/…

…units directory
  • Loading branch information...
kenmazaika committed Feb 29, 2012
1 parent 287780f commit ee1d78355cd29be727008f74f1c38a1b647e1731
Showing with 17 additions and 2 deletions.
  1. +1 −1 lib/turn/reporter.rb
  2. +16 −1 test/reporter_test.rb
@@ -77,7 +77,7 @@ def clean_backtrace(backtrace)
/\/lib\/turn.*\.rb/,
/\/bin\/turn/,
/\/lib\/minitest.*\.rb/,
/\/test\/unit\/(?!.*\_test.rb).*\.rb.*/
/\/test\/unit(?!(\/.*\_test.rb)|.*\/test_.*).*\.rb.*/
])

# Filter backtrace of unimportant entries, and applies count limit if set in
@@ -5,7 +5,7 @@ class TestReporter < Turn::Reporter
end

class TestReporters < Test::Unit::TestCase
def test_unit_test_files_are_filtered_but_project_files_are_not
def test_unit_test_files_are_not_filtered_out_if_ending_in_test
reporter = TestReporter.new(nil)

# If you follow the convention of naming your test files with _test.rb, do not filter that
@@ -17,4 +17,19 @@ def test_unit_test_files_are_filtered_but_project_files_are_not

assert_equal unfiltered_lines, reporter.send(:filter_backtrace, stack_trace)
end

def test_unit_test_files_are_not_filtered_out_if_file_name_starts_with_test_underscore
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/test_omgs.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 ee1d783

Please sign in to comment.
You can’t perform that action at this time.