aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_gemcutter_utilities.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-05 02:37:35 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-05 02:37:35 +0000
commit1633e543db2cc5c1f690840e5e7ea1f2a9af0b55 (patch)
tree2fce34d522a822171b91823dfcf9e0b8a2c9d283 /test/rubygems/test_gem_gemcutter_utilities.rb
parent6dfd56696fb49310149dc5ed7af52c8d7f43e536 (diff)
downloadruby-1633e543db2cc5c1f690840e5e7ea1f2a9af0b55.tar.gz
* lib/rubygems/commands/push_command.rb: Fixed credential download for
`gem push --host` * lib/rubygems/gemcutter_utilities.rb: ditto. * test/rubygems/test_gem_commands_push_command.rb: Test for the above. * test/rubygems/test_gem_gemcutter_utilities.rb: ditto. * lib/rubygems/config_file.rb: Abort if the `gem push` credentials file has insecure permissions. * test/rubygems/test_gem_config_file.rb: Test for the above. * lib/rubygems/ext/builder.rb: Do not look for Gemfile, Isolate, etc. while building gem extensions. * lib/rubygems/package.rb: Unset spec and files list if a gem's signatures cannot be verified. * test/rubygems/test_gem_package.rb: Test for the above. * lib/rubygems/specification.rb: Reduce use of eval. * lib/rubygems/test_case.rb: ditto. * test/rubygems/test_gem_specification.rb: Test setting specification_version for legacy gems. Dup Gem.ruby before untainting in case it's frozen. * lib/rubygems.rb: Reduce use of eval. Only read files when looking for Gemfile, Isolate, etc. * test/rubygems/test_gem.rb: Test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_gemcutter_utilities.rb')
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb
index 8de40f2037..38979ac960 100644
--- a/test/rubygems/test_gem_gemcutter_utilities.rb
+++ b/test/rubygems/test_gem_gemcutter_utilities.rb
@@ -77,9 +77,24 @@ class TestGemGemcutterUtilities < Gem::TestCase
def test_sign_in_with_host
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+
+ util_sign_in [api_key, 200, 'OK'], 'http://example.com', :param
+
+ assert_match "Enter your http://example.com 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'
- assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
+ assert_match "Enter your http://example.com credentials.",
+ @sign_in_ui.output
assert @fetcher.last_request["authorization"]
assert_match %r{Signed in.}, @sign_in_ui.output
@@ -125,14 +140,14 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_match %r{Access Denied.}, @sign_in_ui.output
end
- def util_sign_in response, host = nil
+ def util_sign_in response, host = nil, style = :ENV
skip 'Always uses $stdin on windows' if Gem.win_platform?
email = 'you@example.com'
password = 'secret'
if host
- ENV['RUBYGEMS_HOST'] = host
+ ENV['RUBYGEMS_HOST'] = host if style == :ENV
else
host = Gem.host
end
@@ -144,7 +159,11 @@ class TestGemGemcutterUtilities < Gem::TestCase
@sign_in_ui = Gem::MockGemUi.new "#{email}\n#{password}\n"
use_ui @sign_in_ui do
- @cmd.sign_in
+ if style == :param then
+ @cmd.sign_in host
+ else
+ @cmd.sign_in
+ end
end
end