Class: Guard::Cucumber::NotificationFormatter
- Inherits:
-
Object
- Object
- Guard::Cucumber::NotificationFormatter
- Includes:
- Cucumber::Formatter::Console
- Defined in:
- lib/guard/cucumber/notification_formatter.rb
Overview
The notification formatter is a Cucumber formatter that Guard::Cucumber passes to the Cucumber binary. It writes the ‘rerun.txt` file with the failed features an creates system notifications.
Instance Attribute Summary collapse
-
#step_mother ⇒ Object
readonly
Returns the value of attribute step_mother.
Instance Method Summary collapse
-
#after_feature_element(feature_element) ⇒ Object
After a feature gets run.
-
#after_features(features) ⇒ Object
Notification after all features have completed.
-
#before_feature_element(feature_element) ⇒ Object
Before a feature gets run.
-
#initialize(step_mother, path_or_io, options) ⇒ NotificationFormatter
constructor
Initialize the formatter.
-
#step_name(keyword, step_match, status, source_indent, background, file_colon_line) ⇒ Object
Gets called when a step is done.
Constructor Details
#initialize(step_mother, path_or_io, options) ⇒ NotificationFormatter
Initialize the formatter.
26 27 28 29 30 |
# File 'lib/guard/cucumber/notification_formatter.rb', line 26 def initialize(step_mother, path_or_io, ) @options = @file_names = [] @step_mother = step_mother end |
Instance Attribute Details
#step_mother ⇒ Object (readonly)
Returns the value of attribute step_mother.
18 19 20 |
# File 'lib/guard/cucumber/notification_formatter.rb', line 18 def step_mother @step_mother end |
Instance Method Details
#after_feature_element(feature_element) ⇒ Object
After a feature gets run.
54 55 56 57 58 59 |
# File 'lib/guard/cucumber/notification_formatter.rb', line 54 def after_feature_element(feature_element) if @rerun @file_names << feature_element.file_colon_line @rerun = false end end |
#after_features(features) ⇒ Object
Notification after all features have completed.
36 37 38 39 |
# File 'lib/guard/cucumber/notification_formatter.rb', line 36 def after_features(features) notify_summary write_rerun_features if !@file_names.empty? end |
#before_feature_element(feature_element) ⇒ Object
Before a feature gets run.
45 46 47 48 |
# File 'lib/guard/cucumber/notification_formatter.rb', line 45 def before_feature_element(feature_element) @rerun = false @feature_name = feature_element.name end |
#step_name(keyword, step_match, status, source_indent, background, file_colon_line) ⇒ Object
Gets called when a step is done.
70 71 72 73 74 75 76 77 |
# File 'lib/guard/cucumber/notification_formatter.rb', line 70 def step_name(keyword, step_match, status, source_indent, background, file_colon_line) if [:failed, :pending, :undefined].index(status) @rerun = true step_name = step_match.format_args(lambda { |param| "*#{ param }*" }) ::Guard::Notifier.notify step_name, :title => @feature_name, :image => icon_for(status) end end |