Class: Blink1Formatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- Blink1Formatter
- Defined in:
- lib/blink1_formatter.rb,
lib/blink1_formatter/version.rb
Constant Summary collapse
- COLOR_SUCCESS =
[0, 255, 35]
- COLOR_PENDING =
[255, 200, 0]
- COLOR_FAIL =
[255, 10, 30]
- VERSION =
"0.0.4"
Instance Method Summary collapse
- #blink1 ⇒ Object
- #color ⇒ Object
- #color=(c) ⇒ Object
- #dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
- #example_failed(example) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example) ⇒ Object
Instance Method Details
#blink1 ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/blink1_formatter.rb', line 31 def blink1 unless @blink1 @blink1 = Blink1.new @blink1.open end @blink1 end |
#color ⇒ Object
47 48 49 |
# File 'lib/blink1_formatter.rb', line 47 def color @color || COLOR_SUCCESS end |
#color=(c) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/blink1_formatter.rb', line 39 def color= c unless c.eql?(@color) @color = c blink1.fade_to_rgb(300, c[0], c[1], c[2]) end c end |
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
25 26 27 28 29 |
# File 'lib/blink1_formatter.rb', line 25 def dump_summary(duration, example_count, failure_count, pending_count) super(duration, example_count, failure_count, pending_count) blink1.blink(color[0], color[1], color[2], 2) blink1.fade_to_rgb(500, color[0], color[1], color[2]) end |
#example_failed(example) ⇒ Object
20 21 22 23 |
# File 'lib/blink1_formatter.rb', line 20 def example_failed(example) self.color= COLOR_FAIL super(example) end |
#example_passed(example) ⇒ Object
10 11 12 13 |
# File 'lib/blink1_formatter.rb', line 10 def example_passed(example) self.color= COLOR_SUCCESS if self.color.eql?(COLOR_SUCCESS) super(example) end |
#example_pending(example) ⇒ Object
15 16 17 18 |
# File 'lib/blink1_formatter.rb', line 15 def example_pending(example) self.color= COLOR_PENDING unless self.color.eql?(COLOR_FAIL) super(example) end |