Skip to content

Instantly share code, notes, and snippets.

@itstommymorgan
Created January 2, 2009 02:04
Show Gist options
  • Save itstommymorgan/42445 to your computer and use it in GitHub Desktop.
Save itstommymorgan/42445 to your computer and use it in GitHub Desktop.
require 'autotest/redgreen'
require 'autotest/timestamp'
module Autotest::Naughty
def self.naughty_notify title, text
system "echo \"naughty.notify({title='#{title}', text='#{text}', timeout=10})\" | awesome-client -"
end
Autotest.add_hook :red do |at|
errors = at.files_to_test.map { |k, v| "#{k}:\n #{v.join("\n ")}"}.join("\n\n")
naughty_notify "Tests Failed:", errors
end
## Apparently the :red hook doesn't work, so :green is called every time a test finishes.
Autotest.add_hook :green do |at|
results = at.results[/\d+ tests.*$/]
naughty_notify "Test Results:", results
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment