This file is indexed.

/usr/lib/ruby/vendor_ruby/rspec/mocks/minitest_integration.rb is in ruby-rspec-mocks 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
require 'rspec/mocks'

module RSpec
  module Mocks
    # @private
    module MinitestIntegration
      include ::RSpec::Mocks::ExampleMethods

      def before_setup
        ::RSpec::Mocks.setup
        super
      end

      def after_teardown
        super

        # Only verify if there's not already an error. Otherwise
        # we risk getting the same failure twice, since negative
        # expectation violations raise both when the message is
        # unexpectedly received, and also during `verify` (in case
        # the first failure was caught by user code via a
        # `rescue Exception`).
        ::RSpec::Mocks.verify unless failures.any?
      ensure
        ::RSpec::Mocks.teardown
      end
    end
  end
end

Minitest::Test.send(:include, RSpec::Mocks::MinitestIntegration)

if defined?(::Minitest::Expectation)
  if defined?(::RSpec::Expectations) && ::Minitest::Expectation.method_defined?(:to)
    # rspec/expectations/minitest_integration has already been loaded and
    # has defined `to`/`not_to`/`to_not` on `Minitest::Expectation` so we do
    # not want to here (or else we would interfere with rspec-expectations' definition).
  else
    # ...otherwise, define those methods now. If `rspec/expectations/minitest_integration`
    # is loaded after this file, it'll overide the defintion here.
    Minitest::Expectation.class_eval do
      include RSpec::Mocks::ExpectationTargetMethods

      def to(*args)
        ctx.assertions += 1
        super
      end

      def not_to(*args)
        ctx.assertions += 1
        super
      end

      def to_not(*args)
        ctx.assertions += 1
        super
      end
    end
  end
end

module RSpec
  module Mocks
    remove_const :MockExpectationError
    # Raised when a message expectation is not satisfied.
    MockExpectationError = ::Minitest::Assertion
  end
end