Class: Cucumber::Formatter::Summary

Inherits:
Object
  • Object
show all
Includes:
Console, Io
Defined in:
lib/cucumber/formatter/summary.rb

Overview

Summary formatter, outputting only feature / scenario titles

Constant Summary

Constants included from ANSIColor

ANSIColor::ALIASES

Constants included from Term::ANSIColor

Term::ANSIColor::ATTRIBUTES, Term::ANSIColor::ATTRIBUTE_NAMES, Term::ANSIColor::COLORED_REGEXP

Instance Method Summary collapse

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

#format_duration

Methods included from Io

ensure_dir, ensure_file, ensure_io, included, io?, url?

Constructor Details

#initialize(config) ⇒ Summary

Returns a new instance of Summary.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cucumber/formatter/summary.rb', line 17

def initialize(config)
  @config = config
  @io = ensure_io(config.out_stream, config.error_stream)
  @ast_lookup = AstLookup.new(config)
  @counts = ConsoleCounts.new(@config)
  @issues = ConsoleIssues.new(@config, @ast_lookup)
  @start_time = Time.now

  @config.on_event :test_case_started do |event|
    print_feature event.test_case
    print_test_case event.test_case
  end

  @config.on_event :test_case_finished do |event|
    print_result event.result
  end

  @config.on_event :test_run_finished do |_event|
    duration = Time.now - @start_time
    @io.puts
    print_statistics(duration, @config, @counts, @issues)
  end
end