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

#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?, included, #uncolored

Methods included from Duration

#format_duration

Methods included from Io

ensure_dir, ensure_file, ensure_io

Constructor Details

#initialize(config) ⇒ Summary

Returns a new instance of Summary


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

def initialize(config)
  @config, @io = config, ensure_io(config.out_stream)
  @counts = ConsoleCounts.new(@config)
  @issues = ConsoleIssues.new(@config)
  @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