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, Cygwin, Doom, Linux, Mac, Windows

Constant Summary collapse

IMAGES_DIRECTORY =
File.expand_path(File.dirname(__FILE__) + "/../images/")
SUCCESS_IMAGE =
"#{IMAGES_DIRECTORY}/pass.png"
FAIL_IMAGE =
"#{IMAGES_DIRECTORY}/fail.png"
PENDING_IMAGE =
"#{IMAGES_DIRECTORY}/pending.png"
EXPIRATION_IN_SECONDS =
3

Class Method Summary collapse

Class Method Details

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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/autotest_notification.rb', line 44

def notify(title, msg, img = 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)
  when /darwin/
    Mac.notify(title, msg, img, total, failures, priority)
  when /cygwin/
    Cygwin.notify(title, msg, img)
  when /mswin/
    Windows.notify(title, msg, img)
  end
end

.pluralize(text, number) ⇒ Object



61
62
63
# File 'lib/autotest_notification.rb', line 61

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

.rspec_message(examples, failures, pendings) ⇒ Object



69
70
71
# File 'lib/autotest_notification.rb', line 69

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

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



65
66
67
# File 'lib/autotest_notification.rb', line 65

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