Class: RSpec::Core::Formatters::DocumentationFormatter

### Home Classes Methods

### In Files

- lib/rspec/core/formatters/documentation_formatter.rb

### Parent

RSpec::Core::Formatters::BaseTextFormatter

### Methods

- ::new
- #current_indentation
- #example_failed
- #example_group_chain
- #example_group_finished
- #example_group_started
- #example_passed
- #example_pending
- #failure_output
- #next_failure_index
- #passed_output
- #pending_output

### 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::DocumentationFormatter

### Public Class Methods

new(output) click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 7
    def initialize(output)
      super(output)
      @group_level = 0
    end

### Public Instance Methods

current_indentation() click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 57
    def current_indentation
      '  ' * @group_level
    end

example_failed(example) click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 35
    def example_failed(example)
      super(example)
      output.puts failure_output(example, example.execution_result[:exception])
    end

example_group_chain() click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 61
    def example_group_chain
      example_group.parent_groups.reverse
    end

example_group_finished(example_group) click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 21
    def example_group_finished(example_group)
      @group_level -= 1
    end

example_group_started(example_group) click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 12
    def example_group_started(example_group)
      super(example_group)

      output.puts if @group_level == 0
      output.puts "#{current_indentation}#{example_group.description.strip}"

      @group_level += 1
    end

example_passed(example) click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 25
    def example_passed(example)
      super(example)
      output.puts passed_output(example)
    end

example_pending(example) click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 30
    def example_pending(example)
      super(example)
      output.puts pending_output(example, example.execution_result[:pending_message])
    end

failure_output(example, exception) click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 40
    def failure_output(example, exception)
      failure_color("#{current_indentation}#{example.description.strip} (FAILED - #{next_failure_index})")
    end

next_failure_index() click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 44
    def next_failure_index
      @next_failure_index ||= 0
      @next_failure_index += 1
    end

passed_output(example) click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 49
    def passed_output(example)
      success_color("#{current_indentation}#{example.description.strip}")
    end

pending_output(example, message) click to toggle source

    # File lib/rspec/core/formatters/documentation_formatter.rb, line 53
    def pending_output(example, message)
      pending_color("#{current_indentation}#{example.description.strip} (PENDING: #{message})")
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.