class ShoulderTap::Notification

Constants

DEFAULT_SENDER
FAILURE_ICON
SUCCESS_ICON

Public Class Methods

new(testsuite, sender = nil) click to toggle source
# File lib/shouldertap/notification.rb, line 10
def initialize(testsuite, sender = nil)
  @testsuite = testsuite
  @sender = sender.nil? ? DEFAULT_SENDER : sender
end

Public Instance Methods

icon() click to toggle source
# File lib/shouldertap/notification.rb, line 27
def icon
  resources + (@testsuite.success? ? SUCCESS_ICON : FAILURE_ICON)
end
message() click to toggle source
# File lib/shouldertap/notification.rb, line 23
def message
  success_ratio + ' tests passed'
end
send() click to toggle source
# File lib/shouldertap/notification.rb, line 15
def send
  Notify.notify title, message, :app_name => 'ShoulderTap', :icon => icon
end
title() click to toggle source
# File lib/shouldertap/notification.rb, line 19
def title
  @sender + " - " + (@testsuite.success? ? "Passed" : "Failed")
end

Private Instance Methods

resources() click to toggle source
# File lib/shouldertap/notification.rb, line 37
def resources
  File.dirname(__FILE__) + '/resources/'
end
success_ratio() click to toggle source
# File lib/shouldertap/notification.rb, line 33
def success_ratio
  "#{@testsuite.success_count}/#{@testsuite.size}"
end