Class: MiniTest::ReporterRunner
- Inherits:
-
Unit
- Object
- Unit
- MiniTest::ReporterRunner
- Defined in:
- lib/minitest/reporter_runner.rb
Overview
Runner for MiniTest that supports reporters.
Based upon Ryan Davis of Seattle.rb's MiniTest (MIT License).
Instance Attribute Summary collapse
-
#reporters
Returns the value of attribute reporters.
-
#suites_start_time
Returns the value of attribute suites_start_time.
-
#test_results
Returns the value of attribute test_results.
-
#test_start_time
Returns the value of attribute test_start_time.
Instance Method Summary collapse
- #_run_suite(suite, type)
- #_run_suites(suites, type)
- #before_test(suite, test)
-
#initialize ⇒ ReporterRunner
constructor
A new instance of ReporterRunner.
- #print(*args)
- #puts(*args)
- #record(suite, test, assertions, time, exception)
- #status(io = output)
Constructor Details
#initialize ⇒ ReporterRunner
Returns a new instance of ReporterRunner.
12 13 14 15 16 |
# File 'lib/minitest/reporter_runner.rb', line 12 def initialize super self.reporters = [] self.test_results = {} end |
Instance Attribute Details
#reporters
Returns the value of attribute reporters.
8 9 10 |
# File 'lib/minitest/reporter_runner.rb', line 8 def reporters @reporters end |
#suites_start_time
Returns the value of attribute suites_start_time.
8 9 10 |
# File 'lib/minitest/reporter_runner.rb', line 8 def suites_start_time @suites_start_time end |
#test_results
Returns the value of attribute test_results.
8 9 10 |
# File 'lib/minitest/reporter_runner.rb', line 8 def test_results @test_results end |
#test_start_time
Returns the value of attribute test_start_time.
8 9 10 |
# File 'lib/minitest/reporter_runner.rb', line 8 def test_start_time @test_start_time end |
Instance Method Details
#_run_suite(suite, type)
27 28 29 30 31 32 |
# File 'lib/minitest/reporter_runner.rb', line 27 def _run_suite(suite, type) trigger_callback(:before_suite, suite) super(suite, type) ensure trigger_callback(:after_suite, suite) end |
#_run_suites(suites, type)
18 19 20 21 22 23 24 25 |
# File 'lib/minitest/reporter_runner.rb', line 18 def _run_suites(suites, type) self.suites_start_time = Time.now count_tests!(suites, type) trigger_callback(:before_suites, suites, type) super(suites, type) ensure trigger_callback(:after_suites, suites, type) end |
#before_test(suite, test)
34 35 36 37 |
# File 'lib/minitest/reporter_runner.rb', line 34 def before_test(suite, test) self.test_start_time = Time.now trigger_callback(:before_test, suite, test) end |
#print(*args)
66 67 |
# File 'lib/minitest/reporter_runner.rb', line 66 def print(*args) end |
#puts(*args)
63 64 |
# File 'lib/minitest/reporter_runner.rb', line 63 def puts(*args) end |
#record(suite, test, assertions, time, exception)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/minitest/reporter_runner.rb', line 39 def record(suite, test, assertions, time, exception) self.assertion_count += assertions result = case exception when nil then :pass when Skip then :skip when Assertion then :failure else :error end test_runner = TestRunner.new( suite, test.to_sym, assertions, time, result, exception ) test_results[suite] ||= {} test_results[suite][test.to_sym] = test_runner trigger_callback(result, suite, test, test_runner) end |
#status(io = output)
69 70 |
# File 'lib/minitest/reporter_runner.rb', line 69 def status(io = output) end |