Class: Cucumber::Formatter::ConsoleIssues
- Inherits:
-
Object
- Object
- Cucumber::Formatter::ConsoleIssues
- Includes:
- Console
- Defined in:
- lib/cucumber/formatter/console_issues.rb
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
- #any? ⇒ Boolean
-
#initialize(config, ast_lookup = AstLookup.new(config)) ⇒ ConsoleIssues
constructor
A new instance of ConsoleIssues.
- #to_s ⇒ Object
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, ast_lookup = AstLookup.new(config)) ⇒ ConsoleIssues
Returns a new instance of ConsoleIssues.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cucumber/formatter/console_issues.rb', line 10 def initialize(config, ast_lookup = AstLookup.new(config)) @previous_test_case = nil @issues = Hash.new { |h, k| h[k] = [] } @config = config @config.on_event(:test_case_finished) do |event| if event.test_case != @previous_test_case @previous_test_case = event.test_case @issues[event.result.to_sym] << event.test_case unless event.result.ok?(strict: @config.strict) elsif event.result.passed? @issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?(strict: @config.strict.strict?(:flaky)) @issues[:failed].delete(event.test_case) end end @ast_lookup = ast_lookup end |
Instance Method Details
#any? ⇒ Boolean
33 34 35 |
# File 'lib/cucumber/formatter/console_issues.rb', line 33 def any? @issues.any? end |
#to_s ⇒ Object
26 27 28 29 30 31 |
# File 'lib/cucumber/formatter/console_issues.rb', line 26 def to_s return if @issues.empty? result = Core::Test::Result::TYPES.map { |type| scenario_listing(type, @issues[type]) } result.flatten.join("\n") end |