This file is indexed.

/usr/share/doc/ruby-rspec-expectations/features/custom_matchers/define_block_matcher.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
Feature: define a matcher supporting block expectations

  When you wish to support block expectations (e.g. `expect { ... }.to matcher`) with
  your custom matchers you must specify this. You can do this manually (or determinately
  based on some logic) by defining a `supports_block_expectation?` method or by using
  the DSL's `supports_block_expectations` shortcut method.

  Scenario: define a block matcher manually
    Given a file named "block_matcher_spec.rb" with:
      """ruby
      RSpec::Matchers.define :support_blocks do
        match do |actual|
          actual.is_a? Proc
        end

        def supports_block_expectations?
          true # or some logic
        end
      end

      RSpec.describe "a custom block matcher" do
        specify { expect { }.to support_blocks }
      end
      """
    When I run `rspec ./block_matcher_spec.rb`
    Then the example should pass

  Scenario: define a block matcher using shortcut
    Given a file named "block_matcher_spec.rb" with:
      """ruby
      RSpec::Matchers.define :support_blocks do
        match do |actual|
          actual.is_a? Proc
        end

        supports_block_expectations
      end

      RSpec.describe "a custom block matcher" do
        specify { expect { }.to support_blocks }
      end
      """
    When I run `rspec ./block_matcher_spec.rb`
    Then the example should pass