module SleepingKingStudios::Tasks::Ci::ResultsHelpers

Helper methods for reporting CI results.

Private Instance Methods

results_color(results) click to toggle source

Returns a terminal color corresponding to the state of the results object.

@param results [Object] The results object.

@return [Symbol] The terminal color.

# File lib/sleeping_king_studios/tasks/ci/results_helpers.rb, line 15
def results_color results
  if results.failing?
    :red
  elsif results.respond_to?(:errored?) && results.errored?
    :red
  elsif results.pending? || results.empty?
    :yellow
  else
    :green
  end # if-elsif-else
end
results_state(results) click to toggle source

Returns a state string for the results object.

@param results [Object] The results object.

@return [String] The results state.

# File lib/sleeping_king_studios/tasks/ci/results_helpers.rb, line 32
def results_state results
  if results.respond_to?(:errored?) && results.errored?
    'Errored'
  elsif results.failing?
    'Failing'
  elsif results.pending? || results.empty?
    'Pending'
  else
    'Passing'
  end # if-elsif-else
end