lib/autotest_notification/mac.rb in urubatan-autotest-notification-1.0.1 vs lib/autotest_notification/mac.rb in urubatan-autotest-notification-1.4.0
- old
+ new
@@ -1,10 +1,24 @@
module AutotestNotification
class Mac
+ @last_test_failed = false
+
class << self
- def notify(title, msg, img, failures = 0, pri = 0)
+
+ def notify(title, msg, img, total = 1, failures = 0, pri = 0)
system "growlnotify -n autotest --image #{img} -p #{pri} -m '#{msg}' #{title}"
- system("say #{failures} test#{'s' unless failures == 1} failed.") if SPEAKING && failures > 0
+ say(total, failures) if SPEAKING
end
+
+ def say(total, failures)
+ if failures > 0
+ DOOM_EDITION ? Doom.play_sound(total, failures) : system("say #{failures} test#{'s' unless failures == 1} failed.")
+ @last_test_failed = true
+ elsif @last_test_failed
+ DOOM_EDITION ? Doom.play_sound(total, failures) : system("say All tests passed successfully.")
+ @last_test_failed = false
+ end
+ end
+
end
end
end