class RSpec::Core::Formatters::BaseFormatter
@see RSpec::Core::Reporter
@see RSpec::Core::Formatters::BaseTextFormatter
as they are called from the reporter.
but the BaseTextFormatter documents all of the methods needed to be implemented by a formatter,
RSpec’s built-in formatters are all subclasses of RSpec::Core::Formatters::BaseTextFormatter,
def close
Invoked at the very end, `close` allows the formatter to clean
def close restore_sync_output end
def color_enabled?
def color_enabled? configuration.color_enabled?(output) end
def configuration
def configuration RSpec.configuration end
def dump_failures
def dump_failures end
def dump_pending
def dump_pending end
def dump_summary(duration, example_count, failure_count, pending_count)
def dump_summary(duration, example_count, failure_count, pending_count) @duration = duration @example_count = example_count @failure_count = failure_count @pending_count = pending_count end
def example_failed(example)
-
example
() -- instance of subclass of `RSpec::Core::ExampleGroup`
def example_failed(example) @failed_examples << example end
def example_group_finished(example_group)
-
example_group
() -- subclass of `RSpec::Core::ExampleGroup`
def example_group_finished(example_group) end
def example_group_started(example_group)
-
example_group
() -- subclass of `RSpec::Core::ExampleGroup`
def example_group_started(example_group) @example_group = example_group end
def example_passed(example)
-
example
() -- instance of subclass of `RSpec::Core::ExampleGroup`
def example_passed(example) end
def example_pending(example)
-
example
() -- instance of subclass of `RSpec::Core::ExampleGroup`
def example_pending(example) @pending_examples << example end
def example_started(example)
-
example
() -- instance of subclass of `RSpec::Core::ExampleGroup`
def example_started(example) examples << example end
def find_failed_line(backtrace, path)
def find_failed_line(backtrace, path) path = File.expand_path(path) backtrace.detect { |line| match = line.match(/(.+?):(\d+)(|:\d+)/) match && match[1].downcase == path.downcase } end
def initialize(output)
def initialize(output) @output = output || StringIO.new @example_count = @pending_count = @failure_count = 0 @examples = [] @failed_examples = [] @pending_examples = [] @example_group = nil end
def message(message)
-
message
(String
) --
def message(message) end
def output_supports_sync
def output_supports_sync output.respond_to?(:sync=) end
def profile_examples?
def profile_examples? configuration.profile_examples end
def read_failed_line(exception, example)
def read_failed_line(exception, example) unless matching_line = find_failed_line(exception.backtrace, example.file_path) return "Unable to find matching line from backtrace" end file_path, line_number = matching_line.match(/(.+?):(\d+)(|:\d+)/)[1..2] if File.exist?(file_path) File.readlines(file_path)[line_number.to_i - 1] || "Unable to find matching line in #{file_path}" else "Unable to find #{file_path} to read failed line" end rescue SecurityError "Unable to read failed line" end
def restore_sync_output
def restore_sync_output output.sync = @old_sync if output_supports_sync and !output.closed? end
def seed(number)
- Private: - not intended for use outside RSpec.
def seed(number) end
def start(example_count)
-
example_count
() --
def start(example_count) start_sync_output @example_count = example_count end
def start_dump
def start_dump end
def start_sync_output
def start_sync_output @old_sync, output.sync = output.sync, true if output_supports_sync end
def stop
def stop end