This file is indexed.

/usr/share/doc/ruby-rspec-mocks/features/old_syntax/unstub.feature 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
@allow-old-syntax
Feature: `unstub`

  `unstub` removes a method stub, essentially cleaning up the method
  stub early, rather than waiting for the cleanup that runs at the end
  of the example. The newer non-monkey-patching syntax does not have a direct
  equivalent but in most situations you can achieve the same behavior using
  [`and_call_original`](../configuring-responses/calling-the-original-implementation). The difference is that `obj.unstub(:foo)` completely cleans up the `foo`
  method stub, whereas `allow(obj).to receive(:foo).and_call_original` continues to
  observe calls to the method (important when you are using [spies](../basics/spies)), which could affect the
  method's behavior if it does anything with `caller` as it will include additional rspec stack
  frames.

  Background:
    Given a file named "spec/spec_helper.rb" with:
      """ruby
      RSpec.configure do |config|
        config.mock_with :rspec do |mocks|
          mocks.syntax = :should
        end
      end
      """
    And a file named ".rspec" with:
      """
      --require spec_helper
      """

  Scenario: Unstub a method
    Given a file named "spec/unstub_spec.rb" with:
      """ruby
      RSpec.describe "Unstubbing a method" do
        it "restores the original behavior" do
          string = "hello world"
          string.stub(:reverse) { "hello dlrow" }

          expect {
            string.unstub(:reverse)
          }.to change { string.reverse }.from("hello dlrow").to("dlrow olleh")
        end
      end
      """
    When I run `rspec spec/unstub_spec.rb`
    Then the examples should all pass