Class: CI::Reporter::Runner
- Inherits:
-
MiniTest::Unit
- Object
- MiniTest::Unit
- CI::Reporter::Runner
- Defined in:
- lib/ci/reporter/minitest.rb
Constant Summary collapse
- @@out =
$stdout
Instance Method Summary collapse
- #_run_anything(type) ⇒ Object
- #_run_suite(suite, type) ⇒ Object
- #_run_suites(suites, type) ⇒ Object
- #_run_test(suite, method) ⇒ Object
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #puke(klass, meth, e) ⇒ Object
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
61 62 63 64 |
# File 'lib/ci/reporter/minitest.rb', line 61 def initialize super @report_manager = ReportManager.new("test") end |
Instance Method Details
#_run_anything(type) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ci/reporter/minitest.rb', line 66 def _run_anything(type) suites = MiniTest::Unit::TestCase.send "#{type}_suites" return if suites.empty? started_anything type sync = output.respond_to? :"sync=" # stupid emacs old_sync, output.sync = output.sync, true if sync _run_suites(suites, type) output.sync = old_sync if sync finished_anything(type) end |
#_run_suite(suite, type) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ci/reporter/minitest.rb', line 86 def _run_suite(suite, type) start_suite(suite) header = "#{type}_suite_header" puts send(header, suite) if respond_to? header filter_suite_methods(suite, type).each do |method| _run_test(suite, method) end finish_suite end |
#_run_suites(suites, type) ⇒ Object
82 83 84 |
# File 'lib/ci/reporter/minitest.rb', line 82 def _run_suites(suites, type) suites.map { |suite| _run_suite suite, type } end |
#_run_test(suite, method) ⇒ Object
99 100 101 102 103 104 105 106 107 108 |
# File 'lib/ci/reporter/minitest.rb', line 99 def _run_test(suite, method) start_case(method) result = run_test(suite, method) @assertion_count += result._assertions @test_count += 1 finish_case end |
#puke(klass, meth, e) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/ci/reporter/minitest.rb', line 110 def puke(klass, meth, e) e = case e when MiniTest::Skip then @skips += 1 fault(e, :skip) return "S" unless @verbose "Skipped:\n#{meth}(#{klass}) [#{location e}]:\n#{e.}\n" when MiniTest::Assertion then @failures += 1 fault(e, :failure, meth) "Failure:\n#{meth}(#{klass}) [#{location e}]:\n#{e.}\n" else @errors += 1 fault(e, :error) bt = MiniTest::filter_backtrace(e.backtrace).join "\n " "Error:\n#{meth}(#{klass}):\n#{e.class}: #{e.}\n #{bt}\n" end @report << e e[0, 1] end |