Sha256: 28dc388cb69664f0a207ec8744f5d0f9f40535bf230406209a89c3ad3cf4d0ac

Contents?: true

Size: 840 Bytes

Versions: 145

Compression:

Stored size: 840 Bytes

Contents

require 'rspec/mocks/extensions/marshal'
require 'rspec/mocks/extensions/psych' if defined?(::Psych)

module RSpec
  module Mocks
    # @private
    module Serialization
      # @private
      def self.fix_for(object)
        object.extend(YAML) if defined?(::YAML)
      rescue TypeError
        # Can't extend Fixnums, Symbols, true, false, or nil
      end

      # @private
      module YAML
        # @private
        def to_yaml(options = {})
          return nil if defined?(::Psych) && options.respond_to?(:[]) && options[:nodump]
          return super(options) unless instance_variable_defined?(:@mock_proxy)

          mp = @mock_proxy
          remove_instance_variable(:@mock_proxy)

          begin
            super(options)
          ensure
            @mock_proxy = mp
          end
        end
      end
    end
  end
end

Version data entries

145 entries across 94 versions & 18 rubygems

Version Path
classiccms-0.3.1 vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
classiccms-0.3.0 vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
classiccms-0.3.0 vendor/bundle/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
ftl-0.2.0 vendor/bundle/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
classiccms-0.2.4.pre vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
classiccms-0.2.4.pre vendor/bundle/gems/rspec-mocks-2.10.1/lib/rspec/mocks/serialization.rb
rspec-mocks-2.10.1 lib/rspec/mocks/serialization.rb
rspec-mocks-2.10.0 lib/rspec/mocks/serialization.rb
horseman-0.0.5 vendor/ruby/1.9.1/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
classicCMS-0.2.3 vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb
classicCMS-0.2.2 vendor/bundle/gems/rspec-mocks-2.9.0/lib/rspec/mocks/serialization.rb