Sha256: caa3e1ca12fa39081603a4ff36023c32462b9d7426acd88ad11a6c2d254f4d59

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

require 'spec_helper'

describe 'Zstd compression' do
  min_server_version '4.2'
  require_zstd_compression

  before do
    authorized_client['test'].drop
  end

  context 'when client has snappy compressor option enabled' do
    it 'compresses the message to the server' do
      # Double check that the client has zstd compression enabled
      expect(authorized_client.options[:compressors]).to include('zstd')

      expect(Mongo::Protocol::Compressed).to receive(:new).twice.and_call_original
      expect(Zstd).to receive(:compress).twice.and_call_original
      expect(Zstd).to receive(:decompress).twice.and_call_original

      authorized_client['test'].insert_one(_id: 1, text: 'hello world')
      document = authorized_client['test'].find(_id: 1).first

      expect(document['text']).to eq('hello world')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo-2.15.0.alpha spec/integration/zstd_compression_spec.rb