Sha256: bdb874869c401db8f86fa47ba9293efd33930344d461aebe76b1e56038eea39d
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
# frozen_string_literal: true require "notifier" module TestNotifier extend self NO_NOTIFIERS_MESSAGE = "[TEST NOTIFIER] You have no supported notifiers " \ "installed. Please read documentation.\n" IMAGES = { fail: File.expand_path("#{__dir__}/../resources/fail.png"), error: File.expand_path("#{__dir__}/../resources/error.png"), success: File.expand_path("#{__dir__}/../resources/success.png") }.freeze HUD_SYMBOLS = { fail: "exclamationmark.triangle", error: "xmark.octagon.fill", success: "checkmark.circle" }.freeze TITLES = { fail: "Failed!", success: "Passed!", error: "Error!" }.freeze COLORS = { fail: "orange", success: "green", error: "red" }.freeze attr_accessor :silence_no_notifier_warning def default_notifier=(notifier) Notifier.default_notifier = notifier end def notify(options) options = options.merge( title: TITLES[options[:status]], image: IMAGES[options[:status]], color: COLORS[options[:status]] ) if Notifier.notifier == Notifier::Hud options[:image] = HUD_SYMBOLS[options[:status]] end notifier.notify(options) end def notifier notifier = Notifier.notifier if notifier == Notifier::Placebo && !silence_no_notifier_warning $stderr << NO_NOTIFIERS_MESSAGE end notifier end require "test_notifier/runner" require "test_notifier/stats" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
test_notifier-2.1.0 | lib/test_notifier.rb |