Class: Quarantini::Reporters::MinitestReporter

Inherits:
Minitest::Reporters::BaseReporter
  • Object
show all
Defined in:
lib/quarantini/reporters/minitest_reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ MinitestReporter

Returns a new instance of MinitestReporter.



7
8
9
10
11
12
13
14
# File 'lib/quarantini/reporters/minitest_reporter.rb', line 7

def initialize(options = {})
  super
  @quarantine_results = []
  reports_dir = options.fetch(:reports_dir)
  output_filename = options.fetch(:output_filename)
  @reports_path = File.absolute_path(reports_dir)
  @output_file_path = File.join(@reports_path, output_filename)
end

Instance Method Details

#record(test) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/quarantini/reporters/minitest_reporter.rb', line 16

def record(test)
  super

  if test.error? || test.failure
    register_result(test, false)
  elsif test.skipped?
    register_result(test, nil)
  elsif test.passed?
    register_result(test, true)
  end
end

#reportObject



28
29
30
31
32
# File 'lib/quarantini/reporters/minitest_reporter.rb', line 28

def report
  super
  FileUtils.mkdir_p(@reports_path)
  File.write(@output_file_path, @quarantine_results.to_json)
end