DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

.autotest File

03.23.2007
| 5615 views |
  • submit to reddit
        
require 'autotest/redgreen'
require 'autotest/timestamp'
#require 'autotest/growl'

#require 'autotest/html_report'
#require 'autotest/kdenotify'
#require 'autotest/menu'
#require 'autotest/pretty'
#require 'autotest/snarl'

# Sort-of from http://blog.labratz.net/articles/2006/09/13/growl-autotest-rails-with-zentest-3-4-0
def growl(title, msg, pri=0, stick="", image="")
  image_arg = (!image.empty?) ? "--image #{image}" : ""
  system "growlnotify -n autotest #{image_arg} -p #{pri} -m #{msg.inspect} #{title} #{stick}" 
end

Autotest.add_hook :red do |at|
  growl("Tests Failed", "#{at.files_to_test.size} tests failed", 2, "", "/Applications/Mail.app/Contents/Resources/Caution.tiff")
end

Autotest.add_hook :green do |at|
  growl("Tests Passed", "All tests passed", -2, "", "/Applications/Mail.app/Contents/Resources/certificate.tiff") #if at.tainted
end