mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
* lib/rubygems: Update to RubyGems 2.2.0.preview.1
This brings several new features to RubyGems summarized here: https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
81629f0531
commit
95683e5cb2
25 changed files with 540 additions and 159 deletions
|
@ -12,8 +12,9 @@ class TestGemRequest < Gem::TestCase
|
|||
super
|
||||
|
||||
@proxy_uri = "http://localhost:1234"
|
||||
@uri = URI('http://example')
|
||||
|
||||
@request = Gem::Request.new nil, nil, nil, nil
|
||||
@request = Gem::Request.new @uri, nil, nil, nil
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
@ -25,7 +26,7 @@ class TestGemRequest < Gem::TestCase
|
|||
def test_initialize_proxy
|
||||
proxy_uri = 'http://proxy.example.com'
|
||||
|
||||
request = Gem::Request.new nil, nil, nil, proxy_uri
|
||||
request = Gem::Request.new @uri, nil, nil, proxy_uri
|
||||
|
||||
assert_equal proxy_uri, request.proxy_uri.to_s
|
||||
end
|
||||
|
@ -33,7 +34,7 @@ class TestGemRequest < Gem::TestCase
|
|||
def test_initialize_proxy_URI
|
||||
proxy_uri = 'http://proxy.example.com'
|
||||
|
||||
request = Gem::Request.new nil, nil, nil, URI(proxy_uri)
|
||||
request = Gem::Request.new @uri, nil, nil, URI(proxy_uri)
|
||||
|
||||
assert_equal proxy_uri, request.proxy_uri.to_s
|
||||
end
|
||||
|
@ -43,7 +44,7 @@ class TestGemRequest < Gem::TestCase
|
|||
ENV['http_proxy_user'] = 'foo'
|
||||
ENV['http_proxy_pass'] = 'bar'
|
||||
|
||||
request = Gem::Request.new nil, nil, nil, nil
|
||||
request = Gem::Request.new @uri, nil, nil, nil
|
||||
|
||||
proxy = request.proxy_uri
|
||||
|
||||
|
@ -51,6 +52,32 @@ class TestGemRequest < Gem::TestCase
|
|||
assert_equal 'bar', proxy.password
|
||||
end
|
||||
|
||||
def test_initialize_proxy_ENV_https
|
||||
ENV['https_proxy'] = @proxy_uri
|
||||
|
||||
request = Gem::Request.new URI('https://example'), nil, nil, nil
|
||||
|
||||
proxy = request.proxy_uri
|
||||
|
||||
assert_equal URI(@proxy_uri), proxy
|
||||
end
|
||||
|
||||
def test_get_proxy_from_env_fallback
|
||||
ENV['http_proxy'] = @proxy_uri
|
||||
|
||||
proxy = @request.get_proxy_from_env 'https'
|
||||
|
||||
assert_equal URI(@proxy_uri), proxy
|
||||
end
|
||||
|
||||
def test_get_proxy_from_env_https
|
||||
ENV['https_proxy'] = @proxy_uri
|
||||
|
||||
proxy = @request.get_proxy_from_env 'https'
|
||||
|
||||
assert_equal URI(@proxy_uri), proxy
|
||||
end
|
||||
|
||||
def test_get_proxy_from_env_domain
|
||||
ENV['http_proxy'] = @proxy_uri
|
||||
ENV['http_proxy_user'] = 'foo\user'
|
||||
|
@ -112,7 +139,7 @@ class TestGemRequest < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_user_agent
|
||||
ua = Gem::Request.new(nil, nil, nil, nil).user_agent
|
||||
ua = Gem::Request.new(@uri, nil, nil, nil).user_agent
|
||||
|
||||
assert_match %r%^RubyGems/\S+ \S+ Ruby/\S+ \(.*?\)%, ua
|
||||
assert_match %r%RubyGems/#{Regexp.escape Gem::VERSION}%, ua
|
||||
|
@ -127,7 +154,7 @@ class TestGemRequest < Gem::TestCase
|
|||
Object.send :remove_const, :RUBY_ENGINE if defined?(RUBY_ENGINE)
|
||||
Object.send :const_set, :RUBY_ENGINE, 'vroom'
|
||||
|
||||
ua = Gem::Request.new(nil, nil, nil, nil).user_agent
|
||||
ua = Gem::Request.new(@uri, nil, nil, nil).user_agent
|
||||
|
||||
assert_match %r%\) vroom%, ua
|
||||
ensure
|
||||
|
@ -140,7 +167,7 @@ class TestGemRequest < Gem::TestCase
|
|||
Object.send :remove_const, :RUBY_ENGINE if defined?(RUBY_ENGINE)
|
||||
Object.send :const_set, :RUBY_ENGINE, 'ruby'
|
||||
|
||||
ua = Gem::Request.new(nil, nil, nil, nil).user_agent
|
||||
ua = Gem::Request.new(@uri, nil, nil, nil).user_agent
|
||||
|
||||
assert_match %r%\)%, ua
|
||||
ensure
|
||||
|
@ -153,7 +180,7 @@ class TestGemRequest < Gem::TestCase
|
|||
Object.send :remove_const, :RUBY_PATCHLEVEL
|
||||
Object.send :const_set, :RUBY_PATCHLEVEL, 5
|
||||
|
||||
ua = Gem::Request.new(nil, nil, nil, nil).user_agent
|
||||
ua = Gem::Request.new(@uri, nil, nil, nil).user_agent
|
||||
|
||||
assert_match %r% patchlevel 5\)%, ua
|
||||
ensure
|
||||
|
@ -168,7 +195,7 @@ class TestGemRequest < Gem::TestCase
|
|||
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
||||
Object.send :const_set, :RUBY_REVISION, 6
|
||||
|
||||
ua = Gem::Request.new(nil, nil, nil, nil).user_agent
|
||||
ua = Gem::Request.new(@uri, nil, nil, nil).user_agent
|
||||
|
||||
assert_match %r% revision 6\)%, ua
|
||||
assert_match %r%Ruby/#{Regexp.escape RUBY_VERSION}dev%, ua
|
||||
|
@ -183,7 +210,7 @@ class TestGemRequest < Gem::TestCase
|
|||
Object.send :const_set, :RUBY_PATCHLEVEL, -1
|
||||
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
|
||||
|
||||
ua = Gem::Request.new(nil, nil, nil, nil).user_agent
|
||||
ua = Gem::Request.new(@uri, nil, nil, nil).user_agent
|
||||
|
||||
assert_match %r%\(#{Regexp.escape RUBY_RELEASE_DATE}\)%, ua
|
||||
ensure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue