Class: Test::Unit::Notify::Notifier

### Home Classes Methods

### In Files

- lib/test/unit/notify.rb

### Parent

Object

### Methods

- ::available?
- ::command
- ::commands
- ::new
- #attach_to_mediator
- #finished
- #started

### Class/Module Index

Quicksearch

- Test
- Test::Unit
- Test::Unit::Notify
- Test::Unit::Notify::Growlnotify
- Test::Unit::Notify::Notifier
- Test::Unit::Notify::NotifyCommand
- Test::Unit::Notify::NotifySend

No matching classes.

# Test::Unit::Notify::Notifier

### Constants

ICON_DIR

  @private

### Public Class Methods

available?() click to toggle source

@return [Boolean] return @true@ if test result notification

    is available.

    # File lib/test/unit/notify.rb, line 163
    def available?
      not command.nil?
    end

command() click to toggle source

@private

    # File lib/test/unit/notify.rb, line 168
    def command
      @@command ||= commands.find {|command| command.available?}
    end

commands() click to toggle source

@private

    # File lib/test/unit/notify.rb, line 173
    def commands
      [NotifySend.new, Growlnotify.new]
    end

new() click to toggle source

@private

    # File lib/test/unit/notify.rb, line 183
    def initialize
      @theme = "kinotan"
    end

### Public Instance Methods

attach_to_mediator(mediator) click to toggle source

@private

    # File lib/test/unit/notify.rb, line 188
    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

@private

    # File lib/test/unit/notify.rb, line 201
    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

@private

    # File lib/test/unit/notify.rb, line 196
    def started(result)
      @result = result
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.