Sha256: 82db686f40070317389a74932a75f04b9ad46623c9c87dcb8a16e6cb5b315ba3

Contents?: true

Size: 629 Bytes

Versions: 3

Compression:

Stored size: 629 Bytes

Contents

shared_examples_for 'a serializer' do
  before do
    FileUtils.rm_f filepath
  end

  describe '#dump' do
    before do
      serializer.dump content, filepath
    end

    it 'creates the file with the provided path' do
      expect(File.exist? filepath).to be true
    end

    it 'converts the contents to the appropriate format' do
      expect(File.read(filepath).size).to eq formatted_content.size
    end
  end

  describe '#load' do
    before do
      serializer.dump content, filepath
    end

    it 'loads the dumped object back into memory' do
      expect(serializer.load filepath).to eq content
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rambling-trie-1.0.2 spec/support/shared_examples/a_serializer.rb
rambling-trie-1.0.1 spec/support/shared_examples/a_serializer.rb
rambling-trie-1.0.0 spec/support/shared_examples/a_serializer.rb