Class: Minitest::Blink1Reporter

Inherits:
AbstractReporter
  • Object
show all
Defined in:
lib/minitest/blink1_reporter/class.rb,
lib/minitest/blink1_reporter_plugin.rb

Constant Summary collapse

SUCCESS =
[0, 170, 0]
SKIPPED =
[180, 150, 0]
FAILURE =
[180, 0, 0]
RUNNING =
[170, 0, 180]
FADE =
150
VERSION =
"0.1.1"

Instance Method Summary collapse

Constructor Details

#initialize(_options) ⇒ Blink1Reporter

Returns a new instance of Blink1Reporter.



12
13
14
# File 'lib/minitest/blink1_reporter_plugin.rb', line 12

def initialize(_options)
  @results = []
end

Instance Method Details

#record(result) ⇒ Object



16
17
18
19
# File 'lib/minitest/blink1_reporter_plugin.rb', line 16

def record(result)
  blink1.fade_to_rgb(FADE, *RUNNING)
  @results << result
end

#reportObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/minitest/blink1_reporter_plugin.rb', line 21

def report
  if @results.any?(&:skipped?)
    blink1.fade_to_rgb(FADE, *SKIPPED)
  elsif !@results.all?(&:passed?)
    blink1.fade_to_rgb(FADE, *FAILURE)
  else
    blink1.fade_to_rgb(FADE, *SUCCESS)
  end

  blink1.close
end