Created
October 14, 2014 08:49
-
-
Save radar/fb4ffad6a8bf08834505 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --color | |
| --require spec_helper | |
| --require ./spec/support/lifx | |
| -f LIFXFormatter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'open4' | |
| class LIFXFormatter < RSpec::Core::Formatters::ProgressFormatter | |
| attr_accessor :lifx | |
| RSpec::Core::Formatters.register self, :example_failed, :dump_summary | |
| def initialize(stdout) | |
| super | |
| pid, stdin, stdout, stderr = Open4::popen4("lifx") | |
| @lifx = stdin | |
| end | |
| def example_passed(example) | |
| super | |
| end | |
| def example_failed(example) | |
| super | |
| lifx.puts "fade on Test 0s" | |
| lifx.puts "setcolor Test red brightness:10" | |
| end | |
| def dump_summary(summary) | |
| if summary.failed_examples.empty? | |
| lifx.puts "setcolor Test green brightness:10" | |
| end | |
| super | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment