Module: Overseer::Reporter
Instance Method Summary collapse
- #filter_backtrace(backtrace) ⇒ Object
- #format_backtrace_output(backtrace) ⇒ Object
- #print_header ⇒ Object
- #print_open_issues ⇒ Object
- #print_single_test_result(test) ⇒ Object
- #print_test_issues(test, counter) ⇒ Object
- #print_test_report ⇒ Object
- #report ⇒ Object
Instance Method Details
#filter_backtrace(backtrace) ⇒ Object
56 57 58 59 60 |
# File 'lib/overseer/reporter.rb', line 56 def filter_backtrace(backtrace) backtrace.reject do |line| line.rindex(OVERSEER_DIR, 0) end end |
#format_backtrace_output(backtrace) ⇒ Object
62 63 64 |
# File 'lib/overseer/reporter.rb', line 62 def format_backtrace_output(backtrace) backtrace.map { |line| " # #{line}"}.join("\n") end |
#print_header ⇒ Object
11 12 13 14 |
# File 'lib/overseer/reporter.rb', line 11 def print_header puts "Overseer is running..." puts end |
#print_open_issues ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/overseer/reporter.rb', line 28 def print_open_issues if Overseer.failures_exists? || Overseer.errors_exists? print "\nOpen issues:\n" counter = 1 Overseer.suites.each do |suite| suite.tests.each do |test| unless test.passed? print_test_issues(test, counter) counter += 1 end end end end end |
#print_single_test_result(test) ⇒ Object
24 25 26 |
# File 'lib/overseer/reporter.rb', line 24 def print_single_test_result(test) print(test.passed? ? Color.green(".") : (test.errors? ? Color.red("E") : Color.red("F"))) end |
#print_test_issues(test, counter) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/overseer/reporter.rb', line 43 def print_test_issues(test, counter) puts puts " #{counter}) #{(test.errors?) ? Color.red("Error:") : Color.red("Failure:")}" puts " Test: #{test.name} (in #{test.suite.name} Suite)" exception = if test.errors? test.errors.first else test.failures.first end puts Color.red(" #{exception.}") puts Color.bright_black("#{format_backtrace_output(filter_backtrace(exception.backtrace))}") end |
#print_test_report ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/overseer/reporter.rb', line 16 def print_test_report puts print_open_issues puts puts "Finished in %.3f seconds" % Overseer.total_time puts Color.green("#{Overseer.total_tests} tests, #{Overseer.total_assertions} assertions, #{Overseer.total_failures} failures, #{Overseer.total_errors} errors") end |
#report ⇒ Object
5 6 7 8 9 |
# File 'lib/overseer/reporter.rb', line 5 def report print_header yield print_test_report end |