diff options
author | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-22 16:50:49 +0000 |
---|---|---|
committer | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-22 16:50:49 +0000 |
commit | 89a030795a0ddadfdaabcd2f7a66b87eb92b8265 (patch) | |
tree | 80286003694be68fcb6a53100a6619579d0e63d9 /test/uri | |
parent | 4ed06c9cb79b70da0b5a742cb789f4c22cd46d18 (diff) |
fix failures
* test/uri/test_generic.rb (URI#with_env): unset proxy related env
variables. [Bug #6774]
* test/uri/test_generic.rb (URI#test_find_proxy): fix failures
when proxy related env variables already set. [Bug #6774]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/uri')
-rw-r--r-- | test/uri/test_generic.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index d3a39e823e..9c0b6051a7 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -736,8 +736,10 @@ class URI::TestGeneric < Test::Unit::TestCase # 192.0.2.0/24 is TEST-NET. [RFC3330] def test_find_proxy - assert_nil(URI("http://192.0.2.1/").find_proxy) - assert_nil(URI("ftp://192.0.2.1/").find_proxy) + with_env({}) { + assert_nil(URI("http://192.0.2.1/").find_proxy) + assert_nil(URI("ftp://192.0.2.1/").find_proxy) + } with_env('http_proxy'=>'http://127.0.0.1:8080') { assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy) assert_nil(URI("ftp://192.0.2.1/").find_proxy) @@ -771,6 +773,11 @@ class URI::TestGeneric < Test::Unit::TestCase end unless RUBY_PLATFORM =~ /mswin|mingw/ def with_env(h) + ['http', 'https', 'ftp'].each do |scheme| + name = "#{scheme}_proxy" + h[name] ||= nil + h["CGI_#{name.upcase}"] ||= nil + end begin old = {} h.each_key {|k| old[k] = ENV[k] } |