Sha256: 5aa66ef8cda81ca73d6adb1b3ab6c95a65e295d3433892b8db5b2bc27b4a3978

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true
# rubocop:todo all

require 'lite_spec_helper'

describe 'Mongo::Crypt::Binding' do
  describe 'helper methods' do
    require_libmongocrypt

    describe '#validate_document' do
      context 'with BSON::Document data' do
        it 'does not raise an exception' do
          expect do
            Mongo::Crypt::Binding.validate_document(BSON::Document.new)
          end.not_to raise_error
        end
      end

      context 'with Hash data' do
        it 'does not raise an exception' do
          expect do
            Mongo::Crypt::Binding.validate_document({})
          end.not_to raise_error
        end
      end

      context 'with nil data' do
        it 'raises an exception' do
          expect do
            Mongo::Crypt::Binding.validate_document(nil)
          end.to raise_error(Mongo::Error::CryptError, /Attempted to pass nil data to libmongocrypt/)
        end
      end

      context 'with non-document data' do
        it 'raises an exception' do
          expect do
            Mongo::Crypt::Binding.validate_document('not a bson document')
          end.to raise_error(Mongo::Error::CryptError, /Attempted to pass invalid data to libmongocrypt/)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mongo-2.21.0 spec/mongo/crypt/binding/helpers_spec.rb
mongo-2.20.1 spec/mongo/crypt/binding/helpers_spec.rb
mogno-2.20.0 spec/mongo/crypt/binding/helpers_spec.rb
mogno-1.0.0 spec/mongo/crypt/binding/helpers_spec.rb
mongo-2.20.0 spec/mongo/crypt/binding/helpers_spec.rb
mongo-2.19.3 spec/mongo/crypt/binding/helpers_spec.rb
mongo-2.19.2 spec/mongo/crypt/binding/helpers_spec.rb
mongo-2.19.1 spec/mongo/crypt/binding/helpers_spec.rb
mongo-2.19.0 spec/mongo/crypt/binding/helpers_spec.rb