/usr/lib/ruby/vendor_ruby/rspec/mocks/marshal_extension.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 | module RSpec
module Mocks
# Support for `patch_marshal_to_support_partial_doubles` configuration.
#
# @private
class MarshalExtension
def self.patch!
return if Marshal.respond_to?(:dump_with_rspec_mocks)
Marshal.instance_eval do
class << self
def dump_with_rspec_mocks(object, *rest)
if !::RSpec::Mocks.space.registered?(object) || NilClass === object
dump_without_rspec_mocks(object, *rest)
else
dump_without_rspec_mocks(object.dup, *rest)
end
end
alias_method :dump_without_rspec_mocks, :dump
undef_method :dump
alias_method :dump, :dump_with_rspec_mocks
end
end
end
def self.unpatch!
return unless Marshal.respond_to?(:dump_with_rspec_mocks)
Marshal.instance_eval do
class << self
undef_method :dump_with_rspec_mocks
undef_method :dump
alias_method :dump, :dump_without_rspec_mocks
undef_method :dump_without_rspec_mocks
end
end
end
end
end
end
|