Module: AutotestNotification

Defined in:
lib/autotest_notification/version.rb,
lib/autotest_notification.rb,
lib/autotest_notification/mac.rb,
lib/autotest_notification/buuf.rb,
lib/autotest_notification/doom.rb,
lib/autotest_notification/linux.rb,
lib/autotest_notification/cygwin.rb,
lib/autotest_notification/windows.rb

Overview

:nodoc:

Defined Under Namespace

Modules: VERSION Classes: Buuf, Config, Cygwin, Doom, Linux, Mac, Windows

Class Method Summary collapse

Class Method Details

.notify(title, msg, img = Config.success_image, total = 1, failures = 0, priority = 0) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/autotest_notification.rb', line 57

def notify(title, msg, img = Config.success_image, total = 1, failures = 0, priority = 0)

  img = Doom.image(total, failures) if DOOM_EDITION
  img = Buuf.image(title.downcase) if BUUF

  case RUBY_PLATFORM
  when /linux/
    Linux.notify(title, msg, img, total, failures, priority)
  when /darwin/
    Mac.notify(title, msg, img, total, failures, priority)
  when /cygwin/
    Cygwin.notify(title, msg, img, total, failures)
  when /mswin/
    Windows.notify(title, msg, img)
  end
end

.pluralize(text, number) ⇒ Object



74
75
76
# File 'lib/autotest_notification.rb', line 74

def pluralize(text, number)
  "#{number} #{text}#{'s' if number != 1}"
end

.rspec_message(examples, failures, pendings) ⇒ Object



82
83
84
# File 'lib/autotest_notification.rb', line 82

def rspec_message(examples, failures, pendings)
  "#{pluralize('example', examples)}, #{pluralize('failure', failures)}, #{pendings} pending"
end

.unit_test_message(tests, assertions, failures, errors) ⇒ Object



78
79
80
# File 'lib/autotest_notification.rb', line 78

def unit_test_message(tests, assertions, failures, errors)
  "#{pluralize('test', tests)}, #{pluralize('assertion', assertions)}, #{pluralize('failure', failures)}, #{pluralize('error', errors)}"
end