I’ve taken coldfire’s excellent .autotest and modified it to provide a third state for rspec tests that are still pending.
# vi: ft=ruby require 'autotest/redgreen' require 'autotest/timestamp' module Autotest::GnomeNotify def self.notify title, msg, img system "notify-send '#{title}' '#{msg}' -i #{img} -t 1000" end Autotest.add_hook :ran_command do |at| image_root = "~/.autotest_images" results = [at.results].flatten.join("\n") results.gsub!(/\\e\[\d+m/,'') output = results.slice(/(\d+)\sexamples?,\s(\d+)\sfailures?(,\s(\d+)\spending)*/) puts output.inspect if output if $~[2].to_i > 0 notify "FAIL", "#{output}", "#{image_root}/fail.png" else if $~[4].to_i > 0 notify "Pending", "#{output}", "#{image_root}/pending.png" else notify "Pass", "#{output}", "#{image_root}/pass.png" end end end end end
