File: tcp_spec.rb

package info (click to toggle)
ruby-mongo 2.21.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,764 kB
  • sloc: ruby: 108,806; makefile: 5; sh: 2
file content (17 lines) | stat: -rw-r--r-- 459 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true
# rubocop:todo all

require 'spec_helper'

describe Mongo::Socket::TCP do
  let(:socket) do
    described_class.new('127.0.0.1', SpecConfig.instance.any_port, 5, Socket::AF_INET)
  end

  describe '#human_address' do
    it 'returns the address and tls indicator' do
      addr = socket.send(:socket).remote_address
      expect(socket.send(:human_address)).to eq("#{addr.ip_address}:#{addr.ip_port} (no TLS)")
    end
  end
end