Sha256: f89baea3fd7f6f440d804e98fa81d9f61126b7f855bb38d97d978d2dd47e5e7e

Contents?: true

Size: 1.14 KB

Versions: 7435

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,435 entries across 7,343 versions & 134 rubygems

Version Path
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/marshal_extension.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/marshal_extension.rb
echonet_lite-0.1.0 vendor/bundle/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
bibtex_to_scrapbox-0.2.0 gems/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/marshal_extension.rb
ta910_helloworld-0.1.1 vendor/bundle/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
ta910_helloworld-0.1.0 vendor/bundle/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
bibtex_to_scrapbox-0.1.0 gems/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
logstash-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rspec-mocks-3.5.0/lib/rspec/mocks/marshal_extension.rb
tdiary-5.0.5 vendor/bundle/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
tdiary-5.0.5 vendor/bundle/gems/rspec-mocks-3.5.0/lib/rspec/mocks/marshal_extension.rb
logstash-filter-csharp-0.1.0 vendor/bundle/jruby/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/marshal_extension.rb
logstash-filter-htmlentities-0.1.0 vendor/bundle/jruby/1.9/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
opal-rspec-0.6.1 rspec-mocks/lib/rspec/mocks/marshal_extension.rb
logstash-output-icinga-1.0.0 vendor/jruby/1.9/gems/rspec-mocks-3.6.0/lib/rspec/mocks/marshal_extension.rb
rspec-mocks-3.6.0 lib/rspec/mocks/marshal_extension.rb