class StartingBlocks::ResultBuilder

Public Instance Methods

build_from(run_result) click to toggle source
# File lib/starting_blocks/result_builder.rb, line 5
def build_from run_result
  load_the_output_from(run_result[:text])
    .merge(color: color,
           text: run_result[:text],
           exit_code: run_result[:exit_code],
           success:   run_result[:success])
end

Private Instance Methods

color() click to toggle source
# File lib/starting_blocks/result_builder.rb, line 15
def color
  return :red unless tests_exist?
  return :red if problems_exist?
  return :yellow if skips_exist?
  :green
end
load_the_output_from(text) click to toggle source
# File lib/starting_blocks/result_builder.rb, line 22
def load_the_output_from text
  @output = StartingBlocks::TextParser.new.parse text
end
problems_exist?() click to toggle source
# File lib/starting_blocks/result_builder.rb, line 30
def problems_exist?
  ((@output[:errors] || 0) > 0) or ((@output[:failures] || 0) > 0)
end
skips_exist?() click to toggle source
# File lib/starting_blocks/result_builder.rb, line 34
def skips_exist?
  (@output[:skips] || 0) > 0
end
tests_exist?() click to toggle source
# File lib/starting_blocks/result_builder.rb, line 26
def tests_exist?
  (@output[:tests] || 0) > 0
end