module Eaco::Coverage

Integration with code coverage tools.

Loading this module will start collecting coverage data.

Public Instance Methods

format!() click to toggle source

Formats coverage results using the default formatter.

@return [String] Coverage summary

# File lib/eaco/coverage.rb, line 43
def format!
  Rake::Utils.capture_stdout do
    result && result.format!
  end.strip
end
report!() click to toggle source

Reports coverage data to the remote service

@return [nil]

# File lib/eaco/coverage.rb, line 31
def report!
  simplecov
  Coveralls.push!

  nil
end
start!() click to toggle source

Starts collecting coverage data.

@return [nil]

# File lib/eaco/coverage.rb, line 20
def start!
  Coveralls.wear_merged!(&simplecov_configuration)

  nil
end

Private Instance Methods

result() click to toggle source

The coverage result

@return [SimpleCov::Result]

# File lib/eaco/coverage.rb, line 56
def result
  simplecov.result
end
simplecov() click to toggle source

Configures simplecov using {.simplecov_configuration}

@return [Class] SimpleCov

# File lib/eaco/coverage.rb, line 65
def simplecov
  SimpleCov.configure(&simplecov_configuration)
end
simplecov_configuration() click to toggle source

Configures SimpleCov to use a different directory for each different appraisal Gemfile.

@return [Proc] a SimpleCov configuration block.

# File lib/eaco/coverage.rb, line 75
def simplecov_configuration
  proc do
    gemfile = Eaco::Rake::Utils.gemfile
    coverage_dir "coverage/#{gemfile}"
  end
end