Class: SimpleCov::Formatter::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov-reporter/version.rb,
lib/simplecov-reporter.rb

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#format(result) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/simplecov-reporter.rb', line 5

def format(result)
  name = ENV['COVERAGE_REPORTER_NAME']
  url = ENV['COVERAGE_REPORTER_URL']
  return unless name && url
  # send to a remote server
  keys = [:covered_lines, :missed_lines, :total_lines, :created_at, :covered_percent, :covered_strength]
  h = {}
  keys.each do |k|
    h[k] = result.send(k)
  end
  puts HTTParty.post(url, body: h.merge(name: name))
end