Class: MiniTest::Libnotify

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/libnotify.rb,
lib/minitest/libnotify/version.rb

Overview

Test notifier for minitest via libnotify.

Usage

In your test helper put:

require 'minitest/autorun'
require 'minitest/libnotify'

Config

require 'minitest/autorun'
require 'minitest/libnotify'

reporter = MiniTest::Unit.output
reporter.config[:global][:description]  = "TESTS"
reporter.config[:pass][:description]    = proc { |desc| "#{desc} :)" }
reporter.config[:fail][:description]    = proc { |desc| "#{desc} :(" }
reporter.config[:fail][:icon_path]      = "face-crying.*"

Constant Summary collapse

VERSION =
"0.2.2"

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, config = self.class.default_config) ⇒ Libnotify

Returns a new instance of Libnotify.



52
53
54
55
56
# File 'lib/minitest/libnotify.rb', line 52

def initialize(io, config = self.class.default_config)
  @io         = io
  @libnotify  = nil
  @config     = config.dup
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(msg, *args, &block) ⇒ Object



63
64
65
# File 'lib/minitest/libnotify.rb', line 63

def method_missing(msg, *args, &block)
  @io.send(msg, *args, &block)
end

Class Attribute Details

.default_configObject

Returns the value of attribute default_config.



27
28
29
# File 'lib/minitest/libnotify.rb', line 27

def default_config
  @default_config
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



50
51
52
# File 'lib/minitest/libnotify.rb', line 50

def config
  @config
end

Instance Method Details

#puts(*o) ⇒ Object



58
59
60
61
# File 'lib/minitest/libnotify.rb', line 58

def puts(*o)
  notify(o.first) if libnotify
  @io.puts(*o)
end

#respond_to?(msg) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/minitest/libnotify.rb', line 67

def respond_to?(msg)
  @io.respond_to?(msg) || super
end