class Blink1Rspec3Formatter
Constants
- BLINK_TIMES
- COLOR_FAIL
- COLOR_PENDING
- COLOR_SUCCESS
Public Class Methods
new(output)
click to toggle source
# File lib/blink1_rspec3_formatter.rb, line 14 def initialize(output) @output = output @status = {failure: 0, pending: 0} end
Public Instance Methods
close(notification)
click to toggle source
# File lib/blink1_rspec3_formatter.rb, line 31 def close(notification) blink1 = Blink1.new blink1.open blink_color_and_count = get_color_and_blink_count color = blink_color_and_count[:color] count = blink_color_and_count[:count] if count > 0 blink1.blink(color[0], color[1], color[2], count) end blink1.set_rgb(color[0], color[1], color[2]) sleep(BLINK_TIMES) blink1.off blink1.close end
dump_failures(notification)
click to toggle source
# File lib/blink1_rspec3_formatter.rb, line 19 def dump_failures(notification) unless notification.failure_notifications.empty? @status[:failure] = notification.failed_examples.size end end
dump_pending(notification)
click to toggle source
# File lib/blink1_rspec3_formatter.rb, line 25 def dump_pending(notification) unless notification.pending_examples.empty? @status[:pending] = notification.pending_examples.size end end
Private Instance Methods
get_color_and_blink_count()
click to toggle source
# File lib/blink1_rspec3_formatter.rb, line 54 def get_color_and_blink_count if @status[:failure] > 0 {count: @status[:failure], color: COLOR_FAIL} elsif @status[:pending] > 0 {count: @status[:pending], color: COLOR_PENDING} else {count: 0, color: COLOR_SUCCESS} end end