Last active
December 18, 2015 04:59
-
-
Save dqminh/5729034 to your computer and use it in GitHub Desktop.
rspec formatter that applause you when your tests pass
This file contains 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 "rspec/core/formatters/progress_formatter" | |
class ApplauseFormatter < RSpec::Core::Formatters::ProgressFormatter | |
def initialize(output) | |
super(output) | |
unless File.exists? "/tmp/applause.mp3" | |
p "Downloading applause for awesomeness" | |
system "wget http://www.soundjay.com/human/applause-1.mp3 -O /tmp/applause.mp3" | |
end | |
end | |
def dump_summary(duration, example_count, failure_count, pending_count) | |
super(duration, example_count, failure_count, pending_count) | |
if failure_count == 0 | |
`afplay /tmp/applause.mp3` | |
end | |
end | |
end |
afplay
is not provided by default on Linux, probably best to us aplay
instead no?
cool
_Applause_
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I love it!