Class: ShoulderTap::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/shouldertap/notification.rb

Constant Summary collapse

SUCCESS_ICON =
"dialog-information.png"
FAILURE_ICON =
"dialog-error.png"
DEFAULT_SENDER =
'ShoulderTap'

Instance Method Summary collapse

Constructor Details

#initialize(testsuite, sender = nil) ⇒ Notification

Returns a new instance of Notification.



10
11
12
13
# File 'lib/shouldertap/notification.rb', line 10

def initialize(testsuite, sender = nil)
  @testsuite = testsuite
  @sender = sender.nil? ? DEFAULT_SENDER : sender
end

Instance Method Details

#iconObject



27
28
29
# File 'lib/shouldertap/notification.rb', line 27

def icon
  resources + (@testsuite.success? ? SUCCESS_ICON : FAILURE_ICON)
end

#messageObject



23
24
25
# File 'lib/shouldertap/notification.rb', line 23

def message
  success_ratio + ' tests passed'
end

#sendObject



15
16
17
# File 'lib/shouldertap/notification.rb', line 15

def send
  Notify.notify title, message, :app_name => 'ShoulderTap', :icon => icon
end

#titleObject



19
20
21
# File 'lib/shouldertap/notification.rb', line 19

def title
  @sender + " - " + (@testsuite.success? ? "Passed" : "Failed")
end