Module: TestNotifier
- Extended by:
- TestNotifier
- Included in:
- TestNotifier
- Defined in:
- lib/test_notifier.rb,
lib/test_notifier/stats.rb,
lib/test_notifier/runner.rb,
lib/test_notifier/version.rb
Defined Under Namespace
Modules: Runner, Version
Classes: Stats
Constant Summary
collapse
- 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
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#silence_no_notifier_warning ⇒ Object
Returns the value of attribute silence_no_notifier_warning.
35
36
37
|
# File 'lib/test_notifier.rb', line 35
def silence_no_notifier_warning
@silence_no_notifier_warning
end
|
Instance Method Details
#default_notifier=(notifier) ⇒ Object
37
38
39
|
# File 'lib/test_notifier.rb', line 37
def default_notifier=(notifier)
Notifier.default_notifier = notifier
end
|
#notifier ⇒ Object
55
56
57
58
59
60
61
62
63
|
# File 'lib/test_notifier.rb', line 55
def notifier
notifier = Notifier.notifier
if notifier == Notifier::Placebo && !silence_no_notifier_warning
$stderr << NO_NOTIFIERS_MESSAGE
end
notifier
end
|
#notify(options) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/test_notifier.rb', line 41
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
|