Class: Suzu

Inherits:
RSpec::Core::Formatters::ProgressFormatter
  • Object
show all
Defined in:
lib/suzu.rb

Constant Summary collapse

VT100_COLOR_CODES =
((30..37).to_a + (90..97).to_a).freeze

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Suzu

Returns a new instance of Suzu.



6
7
8
9
10
# File 'lib/suzu.rb', line 6

def initialize(output)
  @example_count = 0

  super
end

Instance Method Details

#example_failed(_example_notification) ⇒ Object



24
25
26
27
28
# File 'lib/suzu.rb', line 24

def example_failed(_example_notification)
  @output.print("\e[#{VT100_COLOR_CODES[@example_count % VT100_COLOR_CODES.count]};41mF\e[m")

  @example_count += 1
end

#example_passed(_example_notification) ⇒ Object



12
13
14
15
16
# File 'lib/suzu.rb', line 12

def example_passed(_example_notification)
  @output.print("\e[#{VT100_COLOR_CODES[@example_count % VT100_COLOR_CODES.count]}m.\e[m")

  @example_count += 1
end

#example_pending(_example_notification) ⇒ Object



18
19
20
21
22
# File 'lib/suzu.rb', line 18

def example_pending(_example_notification)
  @output.print("\e[#{VT100_COLOR_CODES[@example_count % VT100_COLOR_CODES.count]};43m*\e[m")

  @example_count += 1
end