Module: RSpec::Core::Formatters

### Home Classes Methods

### In Files

- lib/rspec/core/formatters.rb
- lib/rspec/core/formatters/base_formatter.rb
- lib/rspec/core/formatters/base_text_formatter.rb
- lib/rspec/core/formatters/deprecation_formatter.rb
- lib/rspec/core/formatters/documentation_formatter.rb
- lib/rspec/core/formatters/helpers.rb
- lib/rspec/core/formatters/html_formatter.rb
- lib/rspec/core/formatters/html_printer.rb
- lib/rspec/core/formatters/json_formatter.rb
- lib/rspec/core/formatters/progress_formatter.rb
- lib/rspec/core/formatters/snippet_extractor.rb
- lib/rspec/core/formatters/text_mate_formatter.rb

### Namespace

- MODULE RSpec::Core::Formatters::Helpers
- CLASS RSpec::Core::Formatters::BaseFormatter
- CLASS RSpec::Core::Formatters::BaseTextFormatter
- CLASS RSpec::Core::Formatters::DeprecationFormatter
- CLASS RSpec::Core::Formatters::DocumentationFormatter
- CLASS RSpec::Core::Formatters::HtmlFormatter
- CLASS RSpec::Core::Formatters::HtmlPrinter
- CLASS RSpec::Core::Formatters::JsonFormatter
- CLASS RSpec::Core::Formatters::ProgressFormatter
- CLASS RSpec::Core::Formatters::SnippetExtractor
- CLASS RSpec::Core::Formatters::TextMateFormatter

### Class/Module Index

Quicksearch

- RSpec
- RSpec::Core
- RSpec::Core::BacktraceCleaner
- RSpec::Core::BacktraceFormatter
- RSpec::Core::CommandLine
- RSpec::Core::Configuration
- RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError
- RSpec::Core::ConfigurationOptions
- RSpec::Core::ConstMissing
- RSpec::Core::DRbCommandLine
- RSpec::Core::DSL
- RSpec::Core::Deprecation
- RSpec::Core::DrbOptions
- RSpec::Core::Example
- RSpec::Core::Example::NotPendingExampleFixed
- RSpec::Core::Example::Procsy
- RSpec::Core::ExampleGroup
- RSpec::Core::Extensions
- RSpec::Core::Extensions::InstanceEvalWithArgs
- RSpec::Core::Extensions::ModuleEvalWithArgs
- RSpec::Core::Extensions::Ordered
- RSpec::Core::Extensions::Ordered::ExampleGroups
- RSpec::Core::Extensions::Ordered::Examples
- RSpec::Core::FilterManager
- RSpec::Core::FilterManager::BackwardCompatibility
- RSpec::Core::FilterManager::Describable
- RSpec::Core::Formatters
- RSpec::Core::Formatters::BaseFormatter
- RSpec::Core::Formatters::BaseTextFormatter
- RSpec::Core::Formatters::DeprecationFormatter
- RSpec::Core::Formatters::DocumentationFormatter
- RSpec::Core::Formatters::Helpers
- RSpec::Core::Formatters::HtmlFormatter
- RSpec::Core::Formatters::HtmlPrinter
- RSpec::Core::Formatters::JsonFormatter
- RSpec::Core::Formatters::ProgressFormatter
- RSpec::Core::Formatters::SnippetExtractor
- RSpec::Core::Formatters::SnippetExtractor::NullConverter
- RSpec::Core::Formatters::TextMateFormatter
- RSpec::Core::Hooks
- RSpec::Core::Hooks::AfterAllHook
- RSpec::Core::Hooks::AfterHook
- RSpec::Core::Hooks::AroundHook
- RSpec::Core::Hooks::AroundHookCollection
- RSpec::Core::Hooks::BeforeHook
- RSpec::Core::Hooks::GroupHookCollection
- RSpec::Core::Hooks::Hook
- RSpec::Core::Hooks::HookCollection
- RSpec::Core::Hooks::HookCollectionAliases
- RSpec::Core::Hooks::RegistersGlobals
- RSpec::Core::MemoizedHelpers
- RSpec::Core::MemoizedHelpers::BeforeAllMemoizedHash
- RSpec::Core::MemoizedHelpers::ClassMethods
- RSpec::Core::Metadata
- RSpec::Core::Metadata::ExampleMetadataHash
- RSpec::Core::Metadata::GroupMetadataHash
- RSpec::Core::Metadata::MetadataHash
- RSpec::Core::MetadataHashBuilder
- RSpec::Core::MetadataHashBuilder::Common
- RSpec::Core::MetadataHashBuilder::WithConfigWarning
- RSpec::Core::MetadataHashBuilder::WithDeprecationWarning
- RSpec::Core::MockFrameworkAdapter
- RSpec::Core::Parser
- RSpec::Core::Pending
- RSpec::Core::Pending::PendingDeclaredInExample
- RSpec::Core::Pending::PendingExampleFixedError
- RSpec::Core::ProjectInitializer
- RSpec::Core::RakeTask
- RSpec::Core::Reporter
- RSpec::Core::RubyProject
- RSpec::Core::Runner
- RSpec::Core::SharedContext
- RSpec::Core::SharedExampleGroup
- RSpec::Core::SharedExampleGroup::Collection
- RSpec::Core::SharedExampleGroup::Registry
- RSpec::Core::SharedExampleGroup::TopLevelDSL
- RSpec::Core::Time
- RSpec::Core::Version
- RSpec::Core::World
- RSpec::Rake
- RSpec::Runner
- Autotest
- Autotest::Rspec2
- Kernel

No matching classes.

# RSpec::Core::Formatters

## Built-in Formatters

- progress (default) - prints dots for passing examples, `F` for failures, `*` for pending

- documentation - prints the docstrings passed to `describe` and `it` methods (and their aliases)

- html

- textmate - html plus links to editor

- json - useful for archiving data for subsequent analysis

The progress formatter is the default, but you can choose any one or more of the other formatters by passing with the `--format` (or `-f` for short) command-line option, e.g.

    rspec --format documentation

You can also send the output of multiple formatters to different streams, e.g.

    rspec --format documentation --format html --out results.html

This example sends the output of the documentation formatter to `$stdout`, and the output of the html formatter to results.html.

## Custom Formatters

You can tell RSpec to use a custom formatter by passing its path and name to the `rspec` commmand. For example, if you define MyCustomFormatter in path/to/my_custom_formatter.rb, you would type this command:

    rspec --require path/to/my_custom_formatter.rb --format MyCustomFormatter

The reporter calls every formatter with this protocol:

- `start(expected_example_count)`

- zero or more of the following

  - `example_group_started(group)`

  - `example_started(example)`

  - `example_passed(example)`

  - `example_failed(example)`

  - `example_pending(example)`

  - `message(string)`

- `stop`

- `start_dump`

- `dump_pending`

- `dump_failures`

- `dump_summary(duration, example_count, failure_count, pending_count)`

- `seed(value)`

- `close`

You can either implement all of those methods or subclass `RSpec::Core::Formatters::BaseTextFormatter` and override the methods you want to enhance.

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.