Class: Lemon::CoverReports::Verbose

Inherits:
Abstract
  • Object
show all
Defined in:
lib/lemon/coverage/formats/verbose.rb

Instance Attribute Summary

Attributes inherited from Abstract

#coverage

Instance Method Summary collapse

Methods inherited from Abstract

#covered_units, #initialize, #tally, #uncovered_cases, #uncovered_units, #undefined_units

Constructor Details

This class inherits a constructor from Lemon::CoverReports::Abstract

Instance Method Details

#renderObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/lemon/coverage/formats/verbose.rb', line 8

def render

  unless covered_units.empty?
    puts "\nCovered Cases: "
    covered_units.map do |unit|
      puts unit_line(unit, :green)
    end
  end

  unless uncovered_units.empty?
    puts "\nUncovered Units: "
    uncovered_units.map do |unit|
      puts unit_line(unit, :yellow)
    end
  end

  unless undefined_units.empty?
    puts "\nUndefined Units: "
    undefined_units.map do |unit|
      puts unit_line(unit, :red)
    end
  end

  unless uncovered_cases.empty?
    puts "\nUncovered Cases: "
    uncovered_cases.map do |mod|
      puts "* " + mod.name.to_s.ansi(:yellow)
    end
  end

  puts
  puts tally
end

#unit_line(unit, color) ⇒ Object



43
44
45
46
# File 'lib/lemon/coverage/formats/verbose.rb', line 43

def unit_line(unit, color)
  data = [unit.to_s.ansi(color), unit.access.to_s, unit.singleton? ? 'class method' : 'instance method']
  "* %s  %s %s" % data
end