/usr/lib/ruby/vendor_ruby/rspec/support/spec/deprecation_helpers.rb is in ruby-rspec-support 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 | module RSpecHelpers
def expect_no_deprecation
expect(RSpec.configuration.reporter).not_to receive(:deprecation)
end
def expect_deprecation_with_call_site(file, line, snippet=//)
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
expect(options[:call_site]).to include([file, line].join(':'))
expect(options[:deprecated]).to match(snippet)
end
end
def expect_deprecation_without_call_site(snippet=//)
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
expect(options[:call_site]).to eq nil
expect(options[:deprecated]).to match(snippet)
end
end
def expect_warn_deprecation_with_call_site(file, line, snippet=//)
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
message = options[:message]
expect(message).to match(snippet)
expect(message).to include([file, line].join(':'))
end
end
def expect_warn_deprecation(snippet=//)
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
message = options[:message]
expect(message).to match(snippet)
end
end
def allow_deprecation
allow(RSpec.configuration.reporter).to receive(:deprecation)
end
def expect_no_deprecations
expect(RSpec.configuration.reporter).not_to receive(:deprecation)
end
def expect_warning_without_call_site(expected=//)
expect(::Kernel).to receive(:warn) do |message|
expect(message).to match expected
expect(message).to_not match(/Called from/)
end
end
def expect_warning_with_call_site(file, line, expected=//)
expect(::Kernel).to receive(:warn) do |message|
expect(message).to match expected
expect(message).to match(/Called from #{file}:#{line}/)
end
end
def expect_no_warnings
expect(::Kernel).not_to receive(:warn)
end
def allow_warning
allow(::Kernel).to receive(:warn)
end
end
|