2022-04-04 11:22:00 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
require 'fast_spec_helper'
|
2022-04-04 11:22:00 +05:30
|
|
|
|
|
|
|
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
|