Module: Minitest

Extended by:
Maxitest::VerboseBacktrace
Defined in:
lib/maxitest/vendor/rg.rb,
lib/maxitest/vendor/line.rb,
lib/maxitest/vendor/line_describe.rb

Overview

Defined Under Namespace

Modules: Line Classes: LineReporter, RG, Runnable, Test

Class Method Summary collapse

Methods included from Maxitest::VerboseBacktrace

plugin_maxitest_verbose_backtrace_init

Class Method Details

.plugin_line_init(options) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/maxitest/vendor/line.rb', line 73

def self.plugin_line_init(options)
  unless exp_line = options[:line]
    reporter.reporters << LineReporter.new
    return
  end

  tests = Minitest::Line.tests_with_lines

  filter, _ = tests.sort_by { |n, l| -l }.detect { |n, l| exp_line >= l }

  raise "Could not find test method before line #{exp_line}" unless filter

  options[:filter] = filter
end

.plugin_line_inject_reporterObject



120
121
# File 'lib/maxitest/vendor/line.rb', line 120

def self.plugin_line_inject_reporter
end

.plugin_line_options(opts, options) ⇒ Object



67
68
69
70
71
# File 'lib/maxitest/vendor/line.rb', line 67

def self.plugin_line_options(opts, options)
  opts.on '-l', '--line N', Integer, "Run test at line number" do |lineno|
    options[:line] = lineno
  end
end

.plugin_rg_init(options) ⇒ Object

:nodoc:



36
37
38
39
40
41
42
43
44
# File 'lib/maxitest/vendor/rg.rb', line 36

def self.plugin_rg_init options # :nodoc:
  if RG.rg?
    io = RG.new options[:io]

    reporter.reporters.grep(Minitest::Reporter).each do |rep|
      rep.io = io
    end
  end
end

.plugin_rg_options(opts, _options) ⇒ Object

:nodoc:



30
31
32
33
34
# File 'lib/maxitest/vendor/rg.rb', line 30

def self.plugin_rg_options opts, _options # :nodoc:
  opts.on "--[no-]rg", "Add red/green to test output." do |bool|
    RG.rg! bool
  end
end