class RSpec::Core::Formatters::BaseFormatter

@see RSpec::Core::Formatters::Protocol
@see RSpec::Core::Reporter
@see RSpec::Core::Formatters::BaseTextFormatter
RSpec’s built-in formatters are all subclasses of RSpec::Core::Formatters::BaseTextFormatter.

def close(_notification)

Other tags:
    See: RSpec::Core::Formatters::Protocol#close -

Parameters:
  • notification (NullNotification) --

Other tags:
    Api: - public
def close(_notification)
  restore_sync_output
end

def example_group_started(notification)

Other tags:
    See: RSpec::Core::Formatters::Protocol#example_group_started -

Parameters:
  • notification (GroupNotification) -- containing example_group subclass of `RSpec::Core::ExampleGroup`

Other tags:
    Api: - public
def example_group_started(notification)
  @example_group = notification.group
end

def initialize(output)

Other tags:
    See: RSpec::Core::Formatters::Protocol#initialize -

Parameters:
  • output (IO) -- the formatter output

Other tags:
    Api: - public
def initialize(output)
  @output = output || StringIO.new
  @example_group = nil
end

def output_supports_sync

def output_supports_sync
  output.respond_to?(:sync=)
end

def restore_sync_output

def restore_sync_output
  output.sync = @old_sync if output_supports_sync && !output.closed?
end

def start(notification)

Other tags:
    See: RSpec::Core::Formatters::Protocol#start -

Parameters:
  • notification (StartNotification) --

Other tags:
    Api: - public
def start(notification)
  start_sync_output
  @example_count = notification.count
end

def start_sync_output

def start_sync_output
  @old_sync, output.sync = output.sync, true if output_supports_sync
end