diff options
author | tyler-ball <tyleraball@gmail.com> | 2015-12-03 13:50:29 -0700 |
---|---|---|
committer | tyler-ball <tyleraball@gmail.com> | 2015-12-09 14:23:53 -0700 |
commit | 200c3e5b71ec269efffbfb97e94f1a7aada951af (patch) | |
tree | 3eabfe9d693eb83cafa42cd43260bf962e99f10c /spec/unit/knife | |
parent | 010392858c2a3a036578b681085704ed1971ab21 (diff) | |
download | chef-200c3e5b71ec269efffbfb97e94f1a7aada951af.tar.gz |
Adding proxifier dependency and leveraging its ability to make TCPSocket.new respect ENV['http_proxy']
Diffstat (limited to 'spec/unit/knife')
-rw-r--r-- | spec/unit/knife/ssl_check_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/knife/ssl_fetch_spec.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/spec/unit/knife/ssl_check_spec.rb b/spec/unit/knife/ssl_check_spec.rb index a9d1145f34..feeb85c8af 100644 --- a/spec/unit/knife/ssl_check_spec.rb +++ b/spec/unit/knife/ssl_check_spec.rb @@ -145,7 +145,7 @@ E let(:ssl_socket) { double(OpenSSL::SSL::SSLSocket) } before do - expect(TCPSocket).to receive(:new).with("foo.example.com", 8443).and_return(tcp_socket) + expect(ssl_check).to receive(:proxified_socket).with("foo.example.com", 8443).and_return(tcp_socket) expect(OpenSSL::SSL::SSLSocket).to receive(:new).with(tcp_socket, ssl_check.verify_peer_ssl_context).and_return(ssl_socket) end @@ -183,7 +183,7 @@ E before do @old_signal = trap(:INT, "DEFAULT") - expect(TCPSocket).to receive(:new). + expect(ssl_check).to receive(:proxified_socket). with("foo.example.com", 8443). and_return(tcp_socket_for_debug) expect(OpenSSL::SSL::SSLSocket).to receive(:new). diff --git a/spec/unit/knife/ssl_fetch_spec.rb b/spec/unit/knife/ssl_fetch_spec.rb index cd0e423459..5982ed9470 100644 --- a/spec/unit/knife/ssl_fetch_spec.rb +++ b/spec/unit/knife/ssl_fetch_spec.rb @@ -139,7 +139,7 @@ E context "when the TLS connection is successful" do before do - expect(TCPSocket).to receive(:new).with("foo.example.com", 8443).and_return(tcp_socket) + expect(ssl_fetch).to receive(:proxified_socket).with("foo.example.com", 8443).and_return(tcp_socket) expect(OpenSSL::SSL::SSLSocket).to receive(:new).with(tcp_socket, ssl_fetch.noverify_peer_ssl_context).and_return(ssl_socket) expect(ssl_socket).to receive(:connect) expect(ssl_socket).to receive(:peer_cert_chain).and_return([self_signed_crt]) @@ -161,7 +161,7 @@ E let(:unknown_protocol_error) { OpenSSL::SSL::SSLError.new("SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol") } before do - expect(TCPSocket).to receive(:new).with("foo.example.com", 80).and_return(tcp_socket) + expect(ssl_fetch).to receive(:proxified_socket).with("foo.example.com", 80).and_return(tcp_socket) expect(OpenSSL::SSL::SSLSocket).to receive(:new).with(tcp_socket, ssl_fetch.noverify_peer_ssl_context).and_return(ssl_socket) expect(ssl_socket).to receive(:connect).and_raise(unknown_protocol_error) |