summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSalim Alam <salam@chef.io>2016-03-21 15:52:13 -0700
committerSalim Alam <salam@chef.io>2016-03-21 20:02:40 -0700
commit908e5386550919760ab4e07ffabd377613e00a3f (patch)
treef8c8fa8a65c6562036be5a880ecda14ea7a5da80 /spec
parent87ec52e3e2bd770d0e770bd970c0569282906652 (diff)
downloadchef-salam/fix-proxy.tar.gz
Fix proxified socketsalam/fix-proxy
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/mixin/proxified_socket_spec.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/spec/unit/mixin/proxified_socket_spec.rb b/spec/unit/mixin/proxified_socket_spec.rb
index 1d752bb600..d3ba54f618 100644
--- a/spec/unit/mixin/proxified_socket_spec.rb
+++ b/spec/unit/mixin/proxified_socket_spec.rb
@@ -26,11 +26,11 @@ end
describe Chef::Mixin::ProxifiedSocket do
- before do
+ before(:all) do
@original_env = ENV.to_hash
end
- after do
+ after(:all) do
ENV.clear
ENV.update(@original_env)
end
@@ -46,7 +46,7 @@ describe Chef::Mixin::ProxifiedSocket do
shared_examples "proxified socket" do
it "wraps the Socket in a Proxifier::Proxy" do
- expect(Proxifier).to receive(:Proxy).with(proxy_uri, no_proxy: no_proxy_spec).and_return(proxifier_double)
+ expect(Proxifier).to receive(:Proxy).with(proxy_uri).and_return(proxifier_double)
expect(proxifier_double).to receive(:open).with(host, port).and_return(socket_double)
expect(test_instance.proxified_socket(host, port)).to eq(socket_double)
end
@@ -54,6 +54,8 @@ describe Chef::Mixin::ProxifiedSocket do
context "when no proxy is set" do
it "returns a plain TCPSocket" do
+ ENV["http_proxy"] = nil
+ ENV["https_proxy"] = nil
expect(TCPSocket).to receive(:new).with(host, port).and_return(socket_double)
expect(test_instance.proxified_socket(host, port)).to eq(socket_double)
end
@@ -84,6 +86,7 @@ describe Chef::Mixin::ProxifiedSocket do
context "when http_proxy is set" do
before do
+ ENV["https_proxy"] = nil
ENV["http_proxy"] = http_uri
end