Method: RSpec::Core::Notifications::SummaryNotification#colorized_totals_line

Defined in:
lib/rspec/core/notifications.rb

#colorized_totals_line(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String

Wraps the results line with colors based on the configured colors for failure, pending, and success. Defaults to red, yellow, green accordingly.

Parameters:

  • colorizer (#wrap) (defaults to: ::RSpec::Core::Formatters::ConsoleCodes)

    An object which supports wrapping text with specific colors.

Returns:

  • (String)

    A colorized results line.

[View source]

347
348
349
350
351
352
353
354
355
# File 'lib/rspec/core/notifications.rb', line 347

def colorized_totals_line(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
  if failure_count > 0 || errors_outside_of_examples_count > 0
    colorizer.wrap(totals_line, RSpec.configuration.failure_color)
  elsif pending_count > 0
    colorizer.wrap(totals_line, RSpec.configuration.pending_color)
  else
    colorizer.wrap(totals_line, RSpec.configuration.success_color)
  end
end