This file is indexed.

/usr/share/doc/ruby-rspec-expectations/features/custom_matchers/access_running_example.feature is in ruby-rspec-expectations 3.4.0c3e0m1s1-1ubuntu1.

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
Feature: access running example

  In the context of a custom matcher, you can call helper methods that are available from the
  current example's example group. This is used, for example, by rspec-rails in order to wrap
  rails' built-in assertions (which depend on helper methods available in the test context).

  Scenario: call method defined on example from matcher
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec::Matchers.define :bar do
        match do |_|
          foo == "foo"
        end
      end

      RSpec.describe "something" do
        def foo
          "foo"
        end

        it "does something" do
          expect("foo").to bar
        end
      end
      """
    When I run `rspec ./example_spec.rb`
    Then the output should contain "1 example, 0 failures"

  Scenario: call method _not_ defined on example from matcher
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec::Matchers.define :bar do
        match do |_|
          foo == "foo"
        end
      end

      RSpec.describe "something" do
        it "does something" do
          expect("foo").to bar
        end
      end
      """
    When I run `rspec ./example_spec.rb`
    Then the output should contain "1 example, 1 failure"
    And the output should match /undefined.*method/
    And the output should contain "RSpec::Matchers::DSL::Matcher"
    And the output should not contain "ExampleGroup"