Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
rspec formatter that applause you when your tests pass
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
@dqminh

This comment has been minimized.

Show comment Hide comment
@dqminh

dqminh Jun 7, 2013

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

Owner

dqminh commented Jun 7, 2013

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

@winston

This comment has been minimized.

Show comment Hide comment
@winston

winston Jun 7, 2013

I love it!

winston commented Jun 7, 2013

I love it!

@envygeeks

This comment has been minimized.

Show comment Hide comment
@envygeeks

envygeeks Jun 8, 2013

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

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

@ilake

This comment has been minimized.

Show comment Hide comment
@ilake

ilake Jun 8, 2013

cool

ilake commented Jun 8, 2013

cool

@coffeesam

This comment has been minimized.

Show comment Hide comment
@coffeesam

coffeesam Jun 10, 2013

_Applause_

_Applause_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment