Sha256: 4ef3f68902c428cba65e9b25f76fbc7fe621b5708904b50ea074244517767b78

Contents?: true

Size: 905 Bytes

Versions: 3

Compression:

Stored size: 905 Bytes

Contents

require 'helper'

describe Twitter::Streaming::Connection do

  describe 'initialize' do
    context 'no options provided' do
      subject(:connection) { Twitter::Streaming::Connection.new }

      it 'sets the default socket classes' do
        expect(connection.tcp_socket_class).to eq TCPSocket
        expect(connection.ssl_socket_class).to eq OpenSSL::SSL::SSLSocket
      end
    end

    context 'custom socket classes provided in opts' do
      class DummyTCPSocket; end
      class DummySSLSocket; end

      subject(:connection) do
        Twitter::Streaming::Connection.new(
          :tcp_socket_class => DummyTCPSocket,
          :ssl_socket_class => DummySSLSocket
        )
      end

      it 'sets the default socket classes' do
        expect(connection.tcp_socket_class).to eq DummyTCPSocket
        expect(connection.ssl_socket_class).to eq DummySSLSocket
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitter-5.11.0 spec/twitter/streaming/connection_spec.rb
twitter-5.10.0 spec/twitter/streaming/connection_spec.rb
twitter-5.9.0 spec/twitter/streaming/connection_spec.rb