Get a popup every time autotest runs your tests with the current result.
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 "
The icons go into your ~/Pictures/rails folder
Alternatively, one could use build-in pictures “gtk-dialog-error” / “gtk-dialog-info”…
Thanks for this: most helpful.
I found that I was getting the red icon because the regexp was recognizing “0 failures” as indicating that there WERE failures, so I rewrote the regexp as follows to make it work:
Hope it helps!
thanks, already fixed it in my working copy, but forgot to post the update, forgetful me
Excellent guide! Worked perfectly!
Great article… very consise. I very recently moved from macOSX to Ubuntu, and I’ve been missing my Autotest + Growl setup. From what I’ve seen so far (I’ve only run a few tests with the new setup) it all works great!
Thanks for the code!
Just want to say thanks — this works perfectly and is just what I have been looking for. Getting hard to do rails when you aren’t one of the cool kids with a mac! btw, to anyone else, the require statement is not needed anymore with the latest zentest gem, since redgreen is in zentest now. The images also aren’t linking any more, but grabbing the rails logo from your public/images and colorizing it with gimp takes 5 seconds.