Sha256: 2b970a099f78d724be0298f8fb258d6cf88306b3341958ca80de061bec5167d0
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
# Base class for all specific notifiers. # # Each notifier should implement +notify+ and +usable?+. # # Note: Base is NOT usable. module RiotNotifier class Base < ::Riot::DotMatrixReporter def initialize(*args, &block) raise "#{self.class} is NOT usable" unless self.class.usable? super end # Notifies you about failures and errors. # This methods should be overridden in order to define specific notifications libraries. def notify(color, msg) # override me end # Tests if this notifier is usable. # Should contain some initialization code e.g. require 'libnotify'. def self.usable? # override false end def self.inherited(notifier) ::RiotNotifier.order.unshift notifier end # Override def fail(desc, message) super notify(:red, "FAILURE: #{message}") end def error(desc, error) super notify(:red, "ERROR: #{error}") end def results(time_taken) super unless bad_results? notify(:green, "%d passes, %d failures, %d errors in %s seconds" % [passes, failures, errors, ("%0.6f" % time_taken)]) end end private def bad_results? failures + errors > 0 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
riot_notifier-0.0.7 | lib/riot_notifier/base.rb |