Class: MinitestBender::Sections::SortedOverview

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest-bender/sections/sorted_overview.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, results_by_context) ⇒ SortedOverview

Returns a new instance of SortedOverview.



4
5
6
7
# File 'lib/minitest-bender/sections/sorted_overview.rb', line 4

def initialize(io, results_by_context)
  @io = io
  @contexts_with_results = sorted_pairs(results_by_context)
end

Instance Method Details



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/minitest-bender/sections/sorted_overview.rb', line 9

def print
  return if trivial?

  io.puts(formatted_label)
  io.puts
  previous_context_path = []
  contexts_with_results.each do |context, results|
    io.puts
    print_context(context, previous_context_path)
    previous_context_path = context.path
    words = []
    results.sort_by(&sort_key).each do |result|
      words = print_result(result, words, results)
    end
  end
  io.puts
  print_divider
end