Class: CI::Reporter::Runner

Inherits:
Minitest::AbstractReporter
  • Object
show all
Defined in:
lib/ci/reporter/minitest.rb

Instance Method Summary collapse

Constructor Details

#initializeRunner

Returns a new instance of Runner.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/ci/reporter/minitest.rb', line 52

def initialize
  @report_manager = ReportManager.new("test")

  # We have to handle this ourselves
  if ENV['CI_CAPTURE'] == "off"
    @capturer = NoCapture.new
  else
    @capturer = ActualCapture.new
  end
  ENV['CI_CAPTURE'] = "off"
end

Instance Method Details

#record(result) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/ci/reporter/minitest.rb', line 70

def record(result)
  # Get the std{out,err} of the now-finished test before
  # changing suites so that its lifecycle matches `result`.
  stdout, stderr = @capturer.finish
  @capturer.start

  # This is the only method that gets to know what test and
  # suite we are in, and is only called at the granularity of a
  # test. We have to work backwards to understand when the suite
  # changes.
  if @current_suite_class != result.class
    finish_suite
    start_suite
  end

  @current_suite_class = result.class
  @current_suite.name = result.class.to_s

  tc = TestCase.new(result.name, result.time, result.assertions)
  tc.failures = result.failures.map {|f| Failure.classify(f)}
  tc.skipped = result.skipped?

  @current_suite.testcases << tc
  @current_suite.assertions += tc.assertions
  @current_suite_stdout << stdout
  @current_suite_stderr << stderr
end

#reportObject



98
99
100
# File 'lib/ci/reporter/minitest.rb', line 98

def report
  finish_suite
end

#startObject



64
65
66
67
68
# File 'lib/ci/reporter/minitest.rb', line 64

def start
  # We start to capture the std{out,err} here so that it is
  # available at the end of the first test run.
  @capturer.start
end