Get a popup every time autotest runs your tests with the current result.


Install:

sudo gem install ZenTest
sudo apt-get install libnotify-bin

.autotest

require 'autotest/redgreen'

module Autotest::Notify
  def self.notify title, msg, img, pri='low', time=3000
    `notify-send -i #{img} -u #{pri} -t #{time} '#{msg}'`
  end

  Autotest.add_hook :ran_command do |autotest|
    results = [autotest.results].flatten.join("\n")
    output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+pending)?/)
    folder = "~/Pictures/rails/"
    if output  =~ /[1-9]\d*\sfailures?/
      notify "FAIL:", "#{output}", folder+"rails_fail.png", 'critical', 10000
    elsif output  =~ /[1-9]\d*\spending?/
      notify "PENDING:", "#{output}", folder+"rails_pending.png", 'normal', 10000
    else
      notify "PASS:", "#{output}", folder+"rails_ok.png"
    end
  end
end
"

Icons for the messages can be found here and should go into your ~/Pictures/rails folder

Alternatively, one could use build-in pictures “gtk-dialog-error” / “gtk-dialog-info”…