# Time notification will be displayed before disappearing automatically
EXPIRATION_IN_SECONDS = 2
ERROR_STOCK_ICON = "gtk-dialog-error"
SUCCESS_STOCK_ICON = "gtk-dialog-info"

# Convenience method to send an error notification message
#
# [stock_icon]   Stock icon name of icon to display
# [title]        Notification message title
# [message]      Core message for the notification
def notify stock_icon, title, message
  options = "-t #{EXPIRATION_IN_SECONDS * 1000} -i #{stock_icon}"
  system "notify-send #{options} '#{title}' '#{message}'"
end

def test_and_notify
  if system "rake TESTOPTS='-v' test"
    notify SUCCESS_STOCK_ICON, "Green", "All tests passed, good job!"
  else
    notify ERROR_STOCK_ICON, "Red", "Some tests failed"
  end
end

watch( 'lib/.*\.rb' ) { |md| test_and_notify } 
watch( 'test/.*\.rb' ) { |md| test_and_notify }

# Time notification will be displayed before disappearing automatically
EXPIRATION_IN_SECONDS = 2
ERROR_STOCK_ICON = "gtk-dialog-error"
SUCCESS_STOCK_ICON = "gtk-dialog-info"

# Convenience method to send an error notification message
#
# [stock_icon]   Stock icon name of icon to display
# [title]        Notification message title
# [message]      Core message for the notification
def notify stock_icon, title, message
  options = "-t #{EXPIRATION_IN_SECONDS * 1000} -i #{stock_icon}"
  system "notify-send #{options} '#{title}' '#{message}'"
end

def test_and_notify
  if system "rake test"
    notify SUCCESS_STOCK_ICON, "Green", "All tests passed, good job!"
  else
    notify ERROR_STOCK_ICON, "Red", "Some tests failed"
  end
end

watch( 'lib/.*\.rb' ) { |md| test_and_notify } 
watch( 'test/.*\.rb' ) { |md| test_and_notify }

--- 
+++ 
@@ -14,7 +14,7 @@
 end
 
 def test_and_notify
-  if system "rake test"
+  if system "rake TESTOPTS='-v' test"
     notify SUCCESS_STOCK_ICON, "Green", "All tests passed, good job!"
   else
     notify ERROR_STOCK_ICON, "Red", "Some tests failed"
Make tests run in verbose mode to pinpoint segfault locations.

Since the switch to minitest, the tests sometimes segfault, probably
through a combination of ordering and environment issues. The regular run
won't give any information about which test caused the segfault. In verbose
mode, however, at least the segfaulting test is known.
