Class RSpec::Core::Formatters::BaseFormatter
In: lib/rspec/core/formatters/base_formatter.rb
Parent: Object

RSpec‘s built-in formatters are all subclasses of RSpec::Core::Formatters::BaseTextFormatter, but the BaseTextFormatter documents all of the methods needed to be implemented by a formatter, as they are called from the reporter.

@see RSpec::Core::Formatters::BaseTextFormatter @see RSpec::Core::Reporter

Methods

Included Modules

Helpers

Attributes

duration  [R] 
example_count  [R] 
example_group  [RW] 
examples  [R] 
failed_examples  [R] 
failure_count  [R] 
output  [R] 
pending_count  [R] 
pending_examples  [R] 

Public Class methods

@api public

@param output

Public Instance methods

@api public

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

@api public

Dumps detailed information about each example failure.

@return [nil]

@api public

Outputs a report of pending examples. This gets invoked after the summary if option is set to do so.

@return [nil]

@api public

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

@param duration @param example_count @param failure_count @param pending_count

@api public

Invoked when an example fails.

@param example instance of subclass of `RSpec::Core::ExampleGroup` @return [Array]

@api public

Invoked at the end of the execution of each example group.

@param example_group subclass of `RSpec::Core::ExampleGroup`

@api public

This method is invoked at the beginning of the execution of each example group.

@param example_group subclass of `RSpec::Core::ExampleGroup`

The next method to be invoked after this is {example_passed}, {example_pending}, or {example_group_finished}.

@param example_group

@api public

Invoked when an example passes.

@param example instance of subclass of `RSpec::Core::ExampleGroup`

Invoked when an example is pending.

@param example instance of subclass of `RSpec::Core::ExampleGroup` @return [Array]

@api public

Invoked at the beginning of the execution of each example.

@param example instance of subclass of `RSpec::Core::ExampleGroup` @return [Array]

@api public

Formats the given backtrace based on configuration and the metadata of the given example.

@api public

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

@param [String] message

@private not intended for use outside RSpec.

@api public

This method is invoked before any examples are run, right after they have all been collected. This can be useful for special formatters that need to provide progress on feedback (graphical ones).

This will only be invoked once, and the next one to be invoked is {example_group_started}.

@param example_count

@api public

This method is invoked after all of the examples have executed. The next method to be invoked after this one is {dump_failures} (BaseTextFormatter then calls {dump_failure} once for each failed example.)

@return [nil]

@api public

Invoked after all examples have executed, before dumping post-run reports.

@return [nil]

Protected Instance methods

[Validate]