Class: RSpec::Core::Formatters::BaseTextFormatter

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/rspec-gc-control/base_text_formatter.rb

Instance Method Summary collapse

Instance Method Details

#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object

Overridden version of this method, to include output about forced GC count and duration, if explicit GC control is enabled.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rspec-gc-control/base_text_formatter.rb', line 11

def dump_summary(duration, example_count, failure_count, pending_count)
  super(duration, example_count, failure_count, pending_count)
  # Don't print out profiled info if there are failures, it just clutters the output
  dump_profile if profile_examples? && failure_count == 0
  output.print "\nFinished in #{format_duration(duration)}"

  gc_times = examples.map { |ex| ex.execution_result[:gc_time] }.select { |t| !t.nil? && (t > 0) }
  if(gc_times.count > 0)
    gc_count = gc_times.count
    gc_time = gc_times.reduce(:+)
    output.print " (including #{gc_count} forced GC cycle(s), totalling #{format_duration(gc_time)})"
  end
  output.print "\n"
  output.puts colorise_summary(summary_line(example_count, failure_count, pending_count))
  dump_commands_to_rerun_failed_examples
end