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) ⇒ ConsoleIssues
constructor
A new instance of ConsoleIssues.
- #to_s ⇒ Object
Methods included from Console
#collect_snippet_data, #do_print_passing_wip, #do_print_profile_information, #do_print_snippets, #embed, #empty_messages, #exception_message_string, #format_step, #format_string, #linebreaks, #print_element_messages, #print_elements, #print_exception, #print_message, #print_messages, #print_passing_wip, #print_profile_information, #print_snippets, #print_statistics, #print_steps, #print_table_row_messages, #puts
Methods included from ANSIColor
#cukes, define_grey, define_real_grey, #green_cukes, #red_cukes, #yellow_cukes
Methods included from Term::ANSIColor
attributes, coloring=, coloring?, #uncolored
Methods included from Duration
Constructor Details
#initialize(config) ⇒ ConsoleIssues
Returns a new instance of ConsoleIssues.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cucumber/formatter/console_issues.rb', line 8 def initialize(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?(@config.strict) elsif event.result.passed? @issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?(@config.strict) @issues[:failed].delete(event.test_case) end end end |
Instance Method Details
#any? ⇒ Boolean
29 30 31 |
# File 'lib/cucumber/formatter/console_issues.rb', line 29 def any? @issues.any? end |
#to_s ⇒ Object
23 24 25 26 27 |
# File 'lib/cucumber/formatter/console_issues.rb', line 23 def to_s return if @issues.empty? result = Core::Test::Result::TYPES.map { |type| scenario_listing(type, @issues[type]) } result.flatten.join("\n") end |