Sha256: f89baea3fd7f6f440d804e98fa81d9f61126b7f855bb38d97d978d2dd47e5e7e

Contents?: true

Size: 1.14 KB

Versions: 7389

Compression:

Stored size: 1.14 KB

Contents

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

Version data entries

7,389 entries across 7,298 versions & 132 rubygems

Version Path
cybrid_api_organization_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_bank_ruby-0.123.117 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_id_ruby-0.123.117 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_organization_ruby-0.123.117 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_bank_ruby-0.123.116 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_organization_ruby-0.123.116 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_id_ruby-0.123.116 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rspec-mocks-3.13.1/lib/rspec/mocks/marshal_extension.rb
cybrid_api_bank_ruby-0.123.115 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_id_ruby-0.123.115 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_organization_ruby-0.123.115 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
ory-client-1.15.17 vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_bank_ruby-0.123.114 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_organization_ruby-0.123.114 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_id_ruby-0.123.114 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_organization_ruby-0.123.113 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_bank_ruby-0.123.113 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_id_ruby-0.123.113 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_organization_ruby-0.123.112 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb
cybrid_api_bank_ruby-0.123.112 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/marshal_extension.rb