Skip to content

Instantly share code, notes, and snippets.

@benwoody
Created September 9, 2012 03:15
Show Gist options
  • Save benwoody/3682371 to your computer and use it in GitHub Desktop.
Save benwoody/3682371 to your computer and use it in GitHub Desktop.
My OSX Autotest and Rspec files
module Autotest::Growl
def self.growl title, msg, img, pri=0, stick=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}"
end
Autotest.add_hook :ran_command do |at|
results = [at.results].flatten.join("\n")
output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+pending)?/)
if output =~ /[1-9]\sfailures?/
growl "Test Results", "#{output}", '~/Dropbox/Photos/autotest/rails_fail.png', 2 #, "-s"
else
growl "Test Results", "#{output}", '~/Dropbox/Photos/autotest/rails_ok.png'
end
end
end
--colour
--drb
--format nested
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment