This file is indexed.

/usr/lib/ruby/vendor_ruby/rspec/core/formatters/documentation_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
RSpec::Support.require_rspec_core "formatters/base_text_formatter"

module RSpec
  module Core
    module Formatters
      # @private
      class DocumentationFormatter < BaseTextFormatter
        Formatters.register self, :example_group_started, :example_group_finished,
                            :example_passed, :example_pending, :example_failed

        def initialize(output)
          super
          @group_level = 0
        end

        def example_group_started(notification)
          output.puts if @group_level == 0
          output.puts "#{current_indentation}#{notification.group.description.strip}"

          @group_level += 1
        end

        def example_group_finished(_notification)
          @group_level -= 1
        end

        def example_passed(passed)
          output.puts passed_output(passed.example)
        end

        def example_pending(pending)
          output.puts pending_output(pending.example,
                                     pending.example.execution_result.pending_message)
        end

        def example_failed(failure)
          output.puts failure_output(failure.example)
        end

      private

        def passed_output(example)
          ConsoleCodes.wrap("#{current_indentation}#{example.description.strip}", :success)
        end

        def pending_output(example, message)
          ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} " \
                            "(PENDING: #{message})",
                            :pending)
        end

        def failure_output(example)
          ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} " \
                            "(FAILED - #{next_failure_index})",
                            :failure)
        end

        def next_failure_index
          @next_failure_index ||= 0
          @next_failure_index += 1
        end

        def current_indentation
          '  ' * @group_level
        end
      end
    end
  end
end