aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_remote_fetcher.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-15 07:29:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-15 07:29:43 +0000
commit985fe77356ca24e78548ca5bce61f2328c49575b (patch)
tree62dd4c9fa013180255c2a0a8323eec8190709e16 /test/rubygems/test_gem_remote_fetcher.rb
parent43f791624a80b8f7b84acdd37e41ec9ae8c1a994 (diff)
downloadruby-985fe77356ca24e78548ca5bce61f2328c49575b.tar.gz
test_gem_remote_fetcher.rb: restore environment variables
* test/rubygems/test_gem_remote_fetcher.rb (setup, teardown): always restore environment variables fo http proxy, to get rid of sporadic warnings from URI::Generic#find_proxy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_remote_fetcher.rb')
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb22
1 files changed, 5 insertions, 17 deletions
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 2d653ef6b8..d3cc388db4 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -78,18 +78,14 @@ gems:
DIR = File.expand_path(File.dirname(__FILE__))
def setup
+ @proxies = %w[http_proxy HTTP_PROXY http_proxy_user HTTP_PROXY_USER http_proxy_pass HTTP_PROXY_PASS no_proxy NO_PROXY]
+ @old_proxies = @proxies.map {|k| ENV[k] }
+ @proxies.each {|k| ENV[k] = nil }
+
super
self.class.start_servers
self.class.enable_yaml = true
self.class.enable_zip = false
- ENV.delete 'http_proxy'
- ENV.delete 'HTTP_PROXY'
- ENV.delete 'http_proxy_user'
- ENV.delete 'HTTP_PROXY_USER'
- ENV.delete 'http_proxy_pass'
- ENV.delete 'HTTP_PROXY_PASS'
- ENV.delete 'no_proxy'
- ENV.delete 'NO_PROXY'
base_server_uri = "http://localhost:#{SERVER_PORT}"
@proxy_uri = "http://localhost:#{PROXY_PORT}"
@@ -114,6 +110,7 @@ gems:
def teardown
super
Gem.configuration[:http_proxy] = nil
+ @proxies.each_with_index {|k, i| ENV[k] = @old_proxies[i] }
end
def test_self_fetcher
@@ -571,21 +568,12 @@ gems:
end
def test_get_proxy_from_env_empty
- orig_env_HTTP_PROXY = ENV['HTTP_PROXY']
- orig_env_http_proxy = ENV['http_proxy']
-
ENV['HTTP_PROXY'] = ''
ENV.delete 'http_proxy'
fetcher = Gem::RemoteFetcher.new nil
assert_equal nil, fetcher.send(:get_proxy_from_env)
-
- ensure
- orig_env_HTTP_PROXY.nil? ? ENV.delete('HTTP_PROXY') :
- ENV['HTTP_PROXY'] = orig_env_HTTP_PROXY
- orig_env_http_proxy.nil? ? ENV.delete('http_proxy') :
- ENV['http_proxy'] = orig_env_http_proxy
end
def test_implicit_no_proxy