Module: Test::Drive::Formatter

Defined in:
lib/test/drive/formatter.rb

Constant Summary collapse

COLORS =
[
    :red,
    :green,
    :yellow,
    :blue,
    :magenta,
    :cyan,
    :white
]

Instance Method Summary collapse

Instance Method Details



17
18
19
20
21
22
23
24
25
# File 'lib/test/drive/formatter.rb', line 17

def print_result(result)
  if result == 'SUCCESS' || result == 'UNSTABLE'
    puts rainbowize '*********************************************************************************************************************************************'
    puts rainbowize Artii::Base.new(font: 'slant').asciify('T E S T - D R I V E N .')
    puts rainbowize '*********************************************************************************************************************************************'
  else
    puts Rainbow(Artii::Base.new.asciify result).red
  end
end

#rainbowize(string) ⇒ Object



28
29
30
31
32
# File 'lib/test/drive/formatter.rb', line 28

def rainbowize(string)
  rainbow_string = ''
  string.length.times { |i| rainbow_string << Rainbow(string[i]).color(COLORS[i % COLORS.length]) }
  rainbow_string
end