Class: Spectator::SuccessNotifier
- Inherits:
-
Object
- Object
- Spectator::SuccessNotifier
- Defined in:
- lib/spectator/success_notifier.rb
Instance Method Summary collapse
- #failed_message ⇒ Object
-
#initialize(config) ⇒ SuccessNotifier
constructor
A new instance of SuccessNotifier.
- #notify(success) ⇒ Object
- #osx? ⇒ Boolean
- #success_message ⇒ Object
Constructor Details
#initialize(config) ⇒ SuccessNotifier
Returns a new instance of SuccessNotifier.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/spectator/success_notifier.rb', line 6 def initialize(config) @config ||= config if osx? begin require 'terminal-notifier' rescue LoadError => e $stderr.puts e. $stderr.puts 'On OSX you should use notification center: gem install terminal-notifier'.red end end end |
Instance Method Details
#failed_message ⇒ Object
28 29 30 31 |
# File 'lib/spectator/success_notifier.rb', line 28 def ||= osx? ? '💔 FAILED'.freeze : '♠♠ FAILED >:( ♠♠'.freeze end |
#notify(success) ⇒ Object
18 19 20 21 |
# File 'lib/spectator/success_notifier.rb', line 18 def notify(success) = success ? : Thread.new { Notify.notify 'RSpec Result:', } end |
#osx? ⇒ Boolean
33 34 35 |
# File 'lib/spectator/success_notifier.rb', line 33 def osx? @osx ||= RUBY_PLATFORM.include? 'darwin' end |
#success_message ⇒ Object
23 24 25 26 |
# File 'lib/spectator/success_notifier.rb', line 23 def ||= osx? ? '🎉 SUCCESS'.freeze : '♥♥ SUCCESS :) ♥♥'.freeze end |