Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4302 - bundler:seg-no-proxy-support, r=indirect
Browse files Browse the repository at this point in the history
[Fetcher] Support setting http_proxy to :no_proxy

Closes #4294
  • Loading branch information
homu committed Feb 16, 2016
2 parents 9a20a1e + f665064 commit 73e2306
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/bundler/fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def connection

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"
Expand Down
9 changes: 8 additions & 1 deletion spec/bundler/fetcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
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")
Expand All @@ -35,6 +36,12 @@
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
Expand Down

0 comments on commit 73e2306

Please sign in to comment.