diff options
author | Salim Alam <salam@chef.io> | 2016-03-21 15:52:13 -0700 |
---|---|---|
committer | Salim Alam <salam@chef.io> | 2016-03-21 21:23:08 -0700 |
commit | 54934c5101d1c953595d820eb178c8479fdee295 (patch) | |
tree | be13c79f86f35189cbedbab48fbefe0ecae9390b /spec/unit | |
parent | 3b500ca0714e95584411c109fd6d4000dee9d50e (diff) | |
download | chef-54934c5101d1c953595d820eb178c8479fdee295.tar.gz |
Fix proxified socket
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/mixin/proxified_socket_spec.rb | 9 |
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 |