Parent

Test::Unit::Notify::Notifier

Constants

ICON_DIR

Public Class Methods

available?() click to toggle source
# File lib/test/unit/notify.rb, line 135
def available?
  not command.nil?
end
command() click to toggle source
# File lib/test/unit/notify.rb, line 139
def command
  @@command ||= commands.find {|command| command.available?}
end
commands() click to toggle source
# File lib/test/unit/notify.rb, line 143
def commands
  [NotifySend.new, Growlnotify.new]
end
new() click to toggle source
# File lib/test/unit/notify.rb, line 150
def initialize
  @theme = "kinotan"
end

Public Instance Methods

attach_to_mediator(mediator) click to toggle source
# File lib/test/unit/notify.rb, line 154
def attach_to_mediator(mediator)
  mediator.add_listener(UI::TestRunnerMediator::STARTED,
                        &method(:started))
  mediator.add_listener(UI::TestRunnerMediator::FINISHED,
                        &method(:finished))
end
finished(elapsed_time) click to toggle source
# File lib/test/unit/notify.rb, line 165
def finished(elapsed_time)
  command = self.class.command
  return if command.nil?

  title = "%s [%g%%] (%gs)" % [@result.status,
                               @result.pass_percentage,
                               elapsed_time]
  parameters = {
    :expire_time => 5,
    :icon => guess_suitable_icon,
    :urgency => urgency,
    :title => title,
    :message => @result.summary,
  }
  command.run(parameters)
end
started(result) click to toggle source
# File lib/test/unit/notify.rb, line 161
def started(result)
  @result = result
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.