Sha256: 1d1d5b98ecc0feb9ca7e10828e9f07dc6e68655065e4532ebb4bf8605e605196

Contents?: true

Size: 704 Bytes

Versions: 3

Compression:

Stored size: 704 Bytes

Contents

require 'spec_helper'

describe Memoizable::Memory do
  let(:memory) { Memoizable::Memory.new }

  context "serialization" do
    let(:deserialized) { Marshal.load(Marshal.dump(memory)) }

    it 'is serializable with Marshal' do
      expect { Marshal.dump(memory) }.not_to raise_error
    end

    it 'is deserializable with Marshal' do
      expect(deserialized).to be_an_instance_of(Memoizable::Memory)
    end

    it 'mantains the same class of cache when deserialized' do
      original_cache     = memory.instance_variable_get(:@memory)
      deserialized_cache = deserialized.instance_variable_get(:@memory)

      expect(deserialized_cache.class).to eql(original_cache.class)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
memoizable-0.4.2 spec/unit/memoizable/memory_spec.rb
memoizable-0.4.1 spec/unit/memoizable/memory_spec.rb
memoizable-0.4.0 spec/unit/memoizable/memory_spec.rb