spec/support/utils.rb
def convert_client_options(spec_test_options)
    uri = Mongo::URI.new('mongodb://localhost')
    mapper = Mongo::URI::OptionsMapper.new
    spec_test_options.reduce({}) do |opts, (name, value)|
      if name == 'autoEncryptOpts'
        opts.merge!(
          auto_encryption_options: convert_auto_encryption_client_options(value)
            .merge(
              # Spawn mongocryptd on non-default port for sharded cluster tests
              extra_options: {
                mongocryptd_spawn_args: ["--port=#{SpecConfig.instance.mongocryptd_port}"],
                mongocryptd_uri: "mongodb://localhost:#{SpecConfig.instance.mongocryptd_port}",
              }
            )
        )
      else
        mapper.add_uri_option(name, value.to_s, opts)
      end

      opts
    end
  end
# Converts camel case clientOptions, as used in spec tests,
# to Ruby driver underscore options.
Converts camel case clientOptions, as used in spec tests,
to Ruby driver underscore options.
Converts camel case clientOptions as used in spec tests to Ruby driver underscore options .
def convert_client_options(spec_test_options)
    uri = Mongo::URI.new('mongodb://localhost')
    mapper = Mongo::URI::OptionsMapper.new
    spec_test_options.reduce({}) do |opts, (name, value)|
      if name == 'autoEncryptOpts'
        opts.merge!(
          auto_encryption_options: convert_auto_encryption_client_options(value)
            .merge(
              extra_options: {
                mongocryptd_spawn_args: ["--port=#{SpecConfig.instance.mongocryptd_port}"],
                mongocryptd_uri: "mongodb://localhost:#{SpecConfig.instance.mongocryptd_port}",
              }
            )
        )
      else
        mapper.add_uri_option(name, value.to_s, opts)
      end
      opts
    end
  end
def convert_client_options ( spec_test_options ) uri = Mongo :: URI . new ( 'mongodb://localhost' ) mapper = Mongo :: URI :: OptionsMapper . new spec_test_options . reduce ( { } ) do | opts , ( name , value ) | if name == 'autoEncryptOpts' opts . merge! ( auto_encryption_options : convert_auto_encryption_client_options ( value ) . merge ( extra_options : { mongocryptd_spawn_args : [ "--port=#{SpecConfig.instance.mongocryptd_port}" ] , mongocryptd_uri : "mongodb://localhost:#{SpecConfig.instance.mongocryptd_port}" , } ) ) else mapper . add_uri_option ( name , value . to_s , opts ) end opts end end
Converts camel case clientOptions, as used in spec tests,
to Ruby driver underscore options.
Converts camel case clientOptions as used in spec tests to Ruby driver underscore options .
# Spawn mongocryptd on non-default port for sharded cluster tests
spec_test_options