/usr/lib/ruby/vendor_ruby/rspec/core/formatters/base_text_formatter.rb is in ruby-rspec-core 3.5.0c3e0m0s0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | RSpec::Support.require_rspec_core "formatters/base_formatter"
RSpec::Support.require_rspec_core "formatters/console_codes"
module RSpec
module Core
module Formatters
# Base for all of RSpec's built-in formatters. See
# RSpec::Core::Formatters::BaseFormatter to learn more about all of the
# methods called by the reporter.
#
# @see RSpec::Core::Formatters::BaseFormatter
# @see RSpec::Core::Reporter
class BaseTextFormatter < BaseFormatter
Formatters.register self,
:message, :dump_summary, :dump_failures, :dump_pending, :seed
# @api public
#
# Used by the reporter to send messages to the output stream.
#
# @param notification [MessageNotification] containing message
def message(notification)
output.puts notification.message
end
# @api public
#
# Dumps detailed information about each example failure.
#
# @param notification [NullNotification]
def dump_failures(notification)
return if notification.failure_notifications.empty?
output.puts notification.fully_formatted_failed_examples
end
# @api public
#
# This method is invoked after the dumping of examples and failures.
# Each parameter is assigned to a corresponding attribute.
#
# @param summary [SummaryNotification] containing duration,
# example_count, failure_count and pending_count
def dump_summary(summary)
output.puts summary.fully_formatted
end
# @private
def dump_pending(notification)
return if notification.pending_examples.empty?
output.puts notification.fully_formatted_pending_examples
end
# @private
def seed(notification)
return unless notification.seed_used?
output.puts notification.fully_formatted
end
# @api public
#
# Invoked at the very end, `close` allows the formatter to clean
# up resources, e.g. open streams, etc.
#
# @param _notification [NullNotification] (Ignored)
def close(_notification)
return unless IO === output
return if output.closed?
output.puts
output.flush
output.close unless output == $stdout
end
end
end
end
end
|