diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-02-15 20:22:31 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-02-15 20:22:31 -0600 |
commit | f6650645c2b2915ad21d588293c2f8e480c6e187 (patch) | |
tree | 33ddc50c87b78bb2457e4a2dddf05106db11464b | |
parent | 9a20a1e5d80c44f2532228dc3c9a03d244de045b (diff) | |
download | bundler-seg-no-proxy-support.tar.gz |
[Fetcher] Support setting http_proxy to :no_proxyseg-no-proxy-support
-rw-r--r-- | lib/bundler/fetcher.rb | 2 | ||||
-rw-r--r-- | spec/bundler/fetcher_spec.rb | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index afbecdd553..b9c4cc7893 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -236,7 +236,7 @@ module Bundler con = Net::HTTP::Persistent.new "bundler", :ENV if gem_proxy = Bundler.rubygems.configuration[:http_proxy] - con.proxy = URI.parse(gem_proxy) + con.proxy = URI.parse(gem_proxy) if gem_proxy != :no_proxy end if remote_uri.scheme == "https" diff --git a/spec/bundler/fetcher_spec.rb b/spec/bundler/fetcher_spec.rb index 5ebffc42ff..015eb81fd9 100644 --- a/spec/bundler/fetcher_spec.rb +++ b/spec/bundler/fetcher_spec.rb @@ -24,8 +24,9 @@ describe Bundler::Fetcher do end end context "when Gem.configuration specifies http_proxy " do + let(:proxy) { "http://proxy-example2.com" } before do - allow(Bundler.rubygems.configuration).to receive(:[]).and_return("http://proxy-example2.com") + allow(Bundler.rubygems.configuration).to receive(:[]).with(:http_proxy).and_return(proxy) end it "consider Gem.configuration when determine proxy" do expect(fetcher.http_proxy).to match("http://proxy-example2.com") @@ -35,6 +36,12 @@ describe Bundler::Fetcher do expect(fetcher.http_proxy).to match("http://proxy-example2.com") end end + context "when the proxy is :no_proxy" do + let(:proxy) { :no_proxy } + it "does not set a proxy" do + expect(fetcher.http_proxy).to be_nil + end + end end context "when a rubygems source mirror is set" do |