Class: MiniTest::Notification
- Inherits:
-
Object
- Object
- MiniTest::Notification
- Defined in:
- lib/minitest/notification.rb,
lib/minitest-notification/version.rb
Overview
Test notifier for minitest via notification center.
Usage
In your test helper put:
require 'minitest/autorun'
require 'minitest/notification'
Constant Summary collapse
- VERSION =
"0.0.4"
Instance Method Summary collapse
-
#initialize(io) ⇒ Notification
constructor
A new instance of Notification.
- #method_missing(msg, *args, &block) ⇒ Object
- #puts(*o) ⇒ Object
Constructor Details
#initialize(io) ⇒ Notification
Returns a new instance of Notification.
15 16 17 |
# File 'lib/minitest/notification.rb', line 15 def initialize(io) @io = io end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(msg, *args, &block) ⇒ Object
32 33 34 |
# File 'lib/minitest/notification.rb', line 32 def method_missing(msg, *args, &block) @io.send(msg, *args, &block) end |
Instance Method Details
#puts(*o) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/minitest/notification.rb', line 19 def puts(*o) if o.first =~ /(\d+) failures, (\d+) errors/ description = [ defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby", RUBY_VERSION, RUBY_PLATFORM ].join(" ") if $1.to_i > 0 || $2.to_i > 0 # fail? TerminalNotifier::Guard.failed(o.first, :title => ":-( #{description}") else TerminalNotifier::Guard.success(o.first, :title => ":-) #{description}") end else @io.puts(*o) end end |