class SimpleCov::Badger::Formatter

Attributes

config[R]

Public Class Methods

new(output = nil) click to toggle source
# File lib/simplecov_badger/formatter.rb, line 5
def initialize(output = nil)
  @output = output || STDOUT
  @config = SimpleCov::Badger.configuration
end

Public Instance Methods

format(result) click to toggle source
# File lib/simplecov_badger/formatter.rb, line 10
def format(result)
  if config.run_if.call
    RestClient.patch(
      config.badge_url,
      { percentage: result.source_files.covered_percent.round(2), token: config.token }
    )

    puts "SimpleCov::Badger: Your badge can be found at: #{config.badge_url}"
  end
end