Sha256: e67019ba04c787684bf4ae81f8bff6e1d33eb671698ef10f1b426e14fd7b0509
Contents?: true
Size: 1.04 KB
Versions: 18
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true # encoding: utf-8 require 'spec_helper' describe Mongo do before do Mongo.tls_context_hooks.clear end describe '#tls_context_hooks' do it 'returns an array' do expect(Mongo.tls_context_hooks).to eq([]) end end describe '#tls_context_hooks=' do context 'when argument is not an array' do it 'raises an ArgumentError' do expect do Mongo.tls_context_hooks = "Hello" end.to raise_error(ArgumentError, /TLS context hooks must be an array of Procs/) end end context 'when argument is an array not containing procs' do it 'raises an ArgumentError' do expect do Mongo.tls_context_hooks = [1, 2, 3] end.to raise_error(ArgumentError, /TLS context hooks must be an array of Procs/) end end it 'saves the provided hooks' do Mongo.tls_context_hooks = [ Proc.new { |x| x ** 2 } ] expect(Mongo.tls_context_hooks.length).to eq(1) expect(Mongo.tls_context_hooks.first).to be_a(Proc) end end end
Version data entries
18 entries across 18 versions & 1 rubygems