Sha256: e49aaee7c29be7f99ed65a01237d9bec9f8dfc7907804ab55be56a39a49f256e
Contents?: true
Size: 959 Bytes
Versions: 16
Compression:
Stored size: 959 Bytes
Contents
module Autotest::Notify def self.notify(title, message, priority='critical') icon = if priority == 'critical' 'dialog-error' else 'dialog-information' end system "notify-send -u #{priority} -t 10000 -i #{icon} '#{title}' '#{message.inspect}'" end Autotest.add_hook :red do |at| tests = 0 assertions = 0 failures = 0 errors = 0 at.results.scan(/(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/) do |t, a, f, e| tests += t.to_i assertions += a.to_i failures += f.to_i errors += e.to_i end message = "%d tests, %d assertions, %d failures, %d errors" % [tests, assertions, failures, errors] notify("Tests Failed", message) end Autotest.add_hook :green do |at| notify("Tests Passed", "Outstanding tests passed", 'low') if at.tainted end Autotest.add_hook :all do |at|_hook notify("autotest", "Tests have fully passed", 'low') end end
Version data entries
16 entries across 16 versions & 3 rubygems