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

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/rspec/core/formatters/base_text_formatter.rb

Overview

Base for all of RSpec's built-in formatters. See RSpec::Core::Formatters::BaseFormatter to learn more about all of the methods called by the reporter.

See Also:

Instance Attribute Summary

Attributes inherited from BaseFormatter

#example_group, #output

Instance Method Summary (collapse)

Methods inherited from BaseFormatter

#example_group_started, #initialize, #start

Constructor Details

This class inherits a constructor from RSpec::Core::Formatters::BaseFormatter

Instance Method Details

- (void) close(_notification)

Invoked at the very end, close allows the formatter to clean up resources, e.g. open streams, etc.

Parameters:

  • notification (NullNotification)
67
68
69
70
71
72
# File 'lib/rspec/core/formatters/base_text_formatter.rb', line 67
def close(_notification)
  return unless IO === output
  return if output.closed? || output == $stdout
  output.close
end

- (void) dump_failures

Dumps detailed information about each example failure.

Parameters:

  • notification (NullNotification)
32
33
34
35
# File 'lib/rspec/core/formatters/base_text_formatter.rb', line 32
def dump_failures(notification)
  return if notification.failure_notifications.empty?
  output.puts notification.fully_formatted_failed_examples
end

- (void) dump_summary

This method is invoked after the dumping of examples and failures. Each parameter is assigned to a corresponding attribute.

Parameters:

  • summary (SummaryNotification)

    containing duration, example_count, failure_count and pending_count

45
46
47
# File 'lib/rspec/core/formatters/base_text_formatter.rb', line 45
def dump_summary(summary)
  output.puts summary.fully_formatted
end

- (void) message

Used by the reporter to send messages to the output stream.

Parameters:

  • notification (MessageNotification)

    containing message

22
23
24
# File 'lib/rspec/core/formatters/base_text_formatter.rb', line 22
def message(notification)
  output.puts notification.message
end