Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

rspec formatter that applause you when your tests pass

View applause_formatter.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
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
Owner
dqminh commented

runs it with rspec --require ./applause_formatter.rb --format ApplauseFormatter

I love it!

afplay is not provided by default on Linux, probably best to us aplay instead no?

ilake commented

cool

Applause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.