Welcome to mirror list, hosted at ThFree Co, Russian Federation.

net_http_adapter_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fdaf35be31ee86193db97212b5d172b52adf8c4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'fast_spec_helper'

RSpec.describe Gitlab::NetHttpAdapter do
  describe '#connect' do
    let(:url) { 'https://example.org' }
    let(:net_http_adapter) { described_class.new(url) }

    subject(:connect) { net_http_adapter.send(:connect) }

    before do
      allow(TCPSocket).to receive(:open).and_return(Socket.new(:INET, :STREAM))
    end

    it 'uses a Gitlab::BufferedIo instance as @socket' do
      connect

      expect(net_http_adapter.instance_variable_get(:@socket)).to be_a(Gitlab::BufferedIo)
    end
  end
end