Method: Fitting::Doc.report

Defined in:
lib/fitting/doc.rb

.report(actions) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/fitting/doc.rb', line 83

def self.report(actions)
  all = 0
  cov = 0
  actions.each do |action|
    action.to_hash.values.first.each do |cover_line|
      if cover_line == nil
        next
      elsif cover_line == 0
        all += 1
      elsif cover_line > 0
        all += 1
        cov += 1
      end
    end
  end
  res = (cov.to_f / all.to_f * 100).round(2)
  puts "Coverage: #{res}%"
  if res == 100.00
    exit 0
  else
    exit 1
  end
end