aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_gemcutter_utilities.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-10 00:52:14 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-10 00:52:14 +0000
commitf06f90323133e2f1440cd5090a622b56994c4e65 (patch)
tree9eb52cdb3b8e0a8bab0c7e10b5c8cdce14762898 /test/rubygems/test_gem_gemcutter_utilities.rb
parent888e5cbbe7398aa814f5a0208a0fd30cfe337f3b (diff)
downloadruby-f06f90323133e2f1440cd5090a622b56994c4e65.tar.gz
* lib/rubygems: Update to RubyGems 2.1.0. Fixes CVE-2013-4287.
See http://rubygems.rubyforge.org/rubygems-update/CVE-2013-4287_txt.html for CVE information. See http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.1.0+%2F+2013-09-09 for release notes. * test/rubygems: Tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_gemcutter_utilities.rb')
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb25
1 files changed, 19 insertions, 6 deletions
diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb
index 18b4518b06..d70ac35beb 100644
--- a/test/rubygems/test_gem_gemcutter_utilities.rb
+++ b/test/rubygems/test_gem_gemcutter_utilities.rb
@@ -101,7 +101,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
def test_sign_in_with_host
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
- util_sign_in [api_key, 200, 'OK'], 'http://example.com', :param
+ util_sign_in [api_key, 200, 'OK'], 'http://example.com', ['http://example.com']
assert_match "Enter your http://example.com credentials.",
@sign_in_ui.output
@@ -112,6 +112,20 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_equal api_key, credentials[:rubygems_api_key]
end
+ def test_sign_in_with_host_nil
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+
+ util_sign_in [api_key, 200, 'OK'], nil, [nil]
+
+ assert_match "Enter your RubyGems.org credentials.",
+ @sign_in_ui.output
+ assert @fetcher.last_request["authorization"]
+ assert_match %r{Signed in.}, @sign_in_ui.output
+
+ credentials = YAML.load_file Gem.configuration.credentials_path
+ assert_equal api_key, credentials[:rubygems_api_key]
+ end
+
def test_sign_in_with_host_ENV
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
util_sign_in [api_key, 200, 'OK'], 'http://example.com'
@@ -163,14 +177,14 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_match %r{Access Denied.}, @sign_in_ui.output
end
- def util_sign_in response, host = nil, style = :ENV
+ def util_sign_in response, host = nil, args = []
skip 'Always uses $stdin on windows' if Gem.win_platform?
email = 'you@example.com'
password = 'secret'
if host
- ENV['RUBYGEMS_HOST'] = host if style == :ENV
+ ENV['RUBYGEMS_HOST'] = host
else
host = Gem.host
end
@@ -182,8 +196,8 @@ class TestGemGemcutterUtilities < Gem::TestCase
@sign_in_ui = Gem::MockGemUi.new "#{email}\n#{password}\n"
use_ui @sign_in_ui do
- if style == :param then
- @cmd.sign_in host
+ if args.length > 0 then
+ @cmd.sign_in(*args)
else
@cmd.sign_in
end
@@ -209,4 +223,3 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
end
-