class SleepingKingStudios::Tasks::Ci::SimpleCovResults

Encapsulates the results of aggregated SimpleCov data.

Public Class Methods

new(results) click to toggle source

@param results [SimpleCov::Result] The raw results of the SimpleCov call.

# File lib/sleeping_king_studios/tasks/ci/simplecov_results.rb, line 13
def initialize results
  @results = results
end

Public Instance Methods

empty?() click to toggle source

@return [Boolean] True if there are no covered lines, otherwise false.

# File lib/sleeping_king_studios/tasks/ci/simplecov_results.rb, line 24
def empty?
  covered_lines.zero?
end
failing?() click to toggle source

@return [Boolean] True if the covered percentage is less than or equal to

the configured value, otherwise false.
# File lib/sleeping_king_studios/tasks/ci/simplecov_results.rb, line 30
def failing?
  covered_percent.round(1) <= failing_percent.round(1)
end
failing_percent() click to toggle source

@return [Float] If the covered percentage is less than or equal to this

value, the result is failing.
# File lib/sleeping_king_studios/tasks/ci/simplecov_results.rb, line 36
def failing_percent
  90.0
end
pending?() click to toggle source

@return [Boolean] True if the covered percentage is less than or equal to

the configured value, otherwise false.
# File lib/sleeping_king_studios/tasks/ci/simplecov_results.rb, line 42
def pending?
  !failing? && covered_percent.round(1) <= pending_percent.round(1)
end
pending_percent() click to toggle source

@return [Float] If the covered percentage is less than or equal to this

value, the result is pending.
# File lib/sleeping_king_studios/tasks/ci/simplecov_results.rb, line 48
def pending_percent
  95.0
end
to_s() click to toggle source

@return [String] The string representation of the results.

# File lib/sleeping_king_studios/tasks/ci/simplecov_results.rb, line 53
def to_s
  str = "#{covered_percent.round(2)}% coverage"

  str << ", #{missed_lines} missed lines"

  str << ", #{total_lines} total lines"
end