Skip to content

Instantly share code, notes, and snippets.

@joenas
Created April 19, 2017 13:08
Show Gist options
  • Save joenas/b6da111c8841ede0c3831a688c7eb5c5 to your computer and use it in GitHub Desktop.
Save joenas/b6da111c8841ede0c3831a688c7eb5c5 to your computer and use it in GitHub Desktop.
OS X notifications with parallel_spec
#!/usr/bin/env ruby
require 'terminal-notifier-guard'
path = ARGV[0] || 'spec'
output = `parallel_rspec #{path} -n 8 --nice`
num = output.scan(/(\d) failure/).flatten.map(&:to_i).inject(0, &:+)
meth = (num>0) ? :failed : :success
TerminalNotifier::Guard.send(meth, "#{num} failures", title: 'RSpec results')
$?.success?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment