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.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/spectator/success_notifier.rb', line 7 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
29 30 31 32 |
# File 'lib/spectator/success_notifier.rb', line 29 def ||= osx? ? '💔 FAILED'.freeze : '♠♠ FAILED >:( ♠♠'.freeze end |
#notify(success) ⇒ Object
19 20 21 22 |
# File 'lib/spectator/success_notifier.rb', line 19 def notify(success) = success ? : Thread.new { Notify.notify 'RSpec Result:', } end |
#osx? ⇒ Boolean
34 35 36 |
# File 'lib/spectator/success_notifier.rb', line 34 def osx? @osx ||= RUBY_PLATFORM.include? 'darwin' end |
#success_message ⇒ Object
24 25 26 27 |
# File 'lib/spectator/success_notifier.rb', line 24 def ||= osx? ? '🎉 SUCCESS'.freeze : '♥♥ SUCCESS :) ♥♥'.freeze end |