Sha256: 3b989ea68d3579bbfa252bc66ceecbeaaead519ba3667ce17dfa48f2018228fe
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
$:.unshift File.dirname(__FILE__) require 'snarl' if RUBY_PLATFORM =~ /mswin/ require 'test/unit/ui/console/testrunner' module Test module Unit module UI module Console class TestRunner FAILED_TITLE = "FAILED" PASSED_TITLE = "Passed" alias finished_original finished def finished(elapsed_time) finished_original(elapsed_time) matches, *output = *@result.to_s.match(/(\d+)\stests,\s(\d+)\sassertions,\s(\d+)\sfailures,\s(\d+)\serrors/) output = output.map {|i| i.to_i } t, a, f, e = output if f > 0 || e > 0 # test has failed or raised an error title = FAILED_TITLE image = e > 0 ? "error.png" : "failure.png" elsif a > 0 # everything's ok title = PASSED_TITLE image = "passed.png" else # no assertions return end image = File.join(File.dirname(__FILE__), "test_notifier", "icons", image) message = "#{t} tests, #{a} assertions, #{f} failures, #{e} errors" if RUBY_PLATFORM =~ /darwin/ system("growlnotify -n test_notifier --image #{image} -p 2 -m #{message} -t #{title}") elsif RUBY_PLATFORM =~ /mswin/ Snarl.show_message(title, message, image) elsif RUBY_PLATFORM =~ /linux/ system("notify-send -i #{image} #{title} \"#{message}\"") end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
test_notifier-0.0.3 | lib/test_notifier.rb |