Sha256: f727166795d4aa3d28e7c7d73d945a9e94615e628639a3ee3a85209e859f816d

Contents?: true

Size: 871 Bytes

Versions: 18

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'spec_helper'

describe 'Zlib compression' do
  require_zlib_compression

  before do
    authorized_client['test'].drop
  end

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

      expect(Mongo::Protocol::Compressed).to receive(:new).twice.and_call_original
      expect(Zlib::Deflate).to receive(:deflate).twice.and_call_original
      expect(Zlib::Inflate).to receive(:inflate).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

18 entries across 18 versions & 1 rubygems

Version Path
mongo-2.16.4 spec/integration/zlib_compression_spec.rb
mongo-2.17.4 spec/integration/zlib_compression_spec.rb
mongo-2.18.3 spec/integration/zlib_compression_spec.rb
mongo-2.18.2 spec/integration/zlib_compression_spec.rb
mongo-2.17.3 spec/integration/zlib_compression_spec.rb
mongo-2.18.1 spec/integration/zlib_compression_spec.rb
mongo-2.18.0 spec/integration/zlib_compression_spec.rb
mongo-2.17.2 spec/integration/zlib_compression_spec.rb
mongo-2.16.3 spec/integration/zlib_compression_spec.rb
mongo-2.18.0.beta1 spec/integration/zlib_compression_spec.rb
mongo-2.16.2 spec/integration/zlib_compression_spec.rb
mongo-2.17.1 spec/integration/zlib_compression_spec.rb
mongo-2.16.1 spec/integration/zlib_compression_spec.rb
mongo-2.17.0 spec/integration/zlib_compression_spec.rb
mongo-2.16.0 spec/integration/zlib_compression_spec.rb
mongo-2.15.1 spec/integration/zlib_compression_spec.rb
mongo-2.16.0.alpha1 spec/integration/zlib_compression_spec.rb
mongo-2.15.0 spec/integration/zlib_compression_spec.rb