Class: Cucumber::Formatter::GlobalHooksSummary
- Inherits:
-
Object
- Object
- Cucumber::Formatter::GlobalHooksSummary
- Includes:
- Console
- Defined in:
- lib/cucumber/formatter/global_hooks_summary.rb
Overview
AllHookSummary formatter, keep track of failures in Before/AfterAll hooks
Constant Summary
Constants included from ANSIColor
Constants included from Term::ANSIColor
Term::ANSIColor::ATTRIBUTES, Term::ANSIColor::ATTRIBUTE_NAMES, Term::ANSIColor::COLORED_REGEXP
Instance Method Summary collapse
- #exception_listing ⇒ Object
-
#initialize(config) ⇒ GlobalHooksSummary
constructor
A new instance of GlobalHooksSummary.
- #ok? ⇒ Boolean
Methods included from Console
#attach, #collect_snippet_data, #collect_undefined_parameter_type_names, #do_print_passing_wip, #do_print_profile_information, #do_print_snippets, #do_print_undefined_parameter_type_snippet, #exception_message_string, #format_step, #format_string, #indent, #linebreaks, #print_element_messages, #print_elements, #print_exception, #print_passing_wip, #print_profile_information, #print_snippets, #print_statistics
Methods included from ANSIColor
apply_custom_colors, #cukes, #green_cukes, #red_cukes, #yellow_cukes
Methods included from Term::ANSIColor
#attributes, included, #uncolored
Methods included from Duration
Constructor Details
#initialize(config) ⇒ GlobalHooksSummary
Returns a new instance of GlobalHooksSummary.
16 17 18 19 20 21 22 23 |
# File 'lib/cucumber/formatter/global_hooks_summary.rb', line 16 def initialize(config) @config = config @all_hook_failures = [] @config.on_event :test_run_hook_finished do |event| @all_hook_failures << event unless event.test_result.ok? end end |
Instance Method Details
#exception_listing ⇒ Object
29 30 31 32 33 |
# File 'lib/cucumber/formatter/global_hooks_summary.rb', line 29 def exception_listing [format_string('Global hook failures:', :failed)] + @all_hook_failures.map do |event| format_string("#{event.hook.location} # #{event.test_result.exception} (#{event.test_result.exception.class})", :failed) end end |
#ok? ⇒ Boolean
25 26 27 |
# File 'lib/cucumber/formatter/global_hooks_summary.rb', line 25 def ok? @all_hook_failures.empty? end |