Autotest 3.5.0 and Growl

Date:

Autotest 3.5.0 is out, and the result given from Autotest is no longer a String, it’s an array of strings. So if you still want Growl to function properly just modify the .autotest slightly:

#ruby

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|
    output = at.results.last.slice(/(\d+)\s.*specifications?,\s(\d+)\s.*failures?/)
    if output =~ /[1-9]\sfailures?/
      growl "Test Results", "#{output}", '~/Library/autotest/rails_fail.png', 2 #, "-s"
    else
      growl "Test Results", "#{output}", '~/Library/autotest/rails_ok.png'
    end
  end
end