diff options
Diffstat (limited to 'test/rubygems/test_gem_gemcutter_utilities.rb')
-rw-r--r-- | test/rubygems/test_gem_gemcutter_utilities.rb | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb index d70ac35beb..18b4518b06 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', ['http://example.com'] + util_sign_in [api_key, 200, 'OK'], 'http://example.com', :param assert_match "Enter your http://example.com credentials.", @sign_in_ui.output @@ -112,20 +112,6 @@ 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' @@ -177,14 +163,14 @@ class TestGemGemcutterUtilities < Gem::TestCase assert_match %r{Access Denied.}, @sign_in_ui.output end - def util_sign_in response, host = nil, args = [] + 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 @@ -196,8 +182,8 @@ class TestGemGemcutterUtilities < Gem::TestCase @sign_in_ui = Gem::MockGemUi.new "#{email}\n#{password}\n" use_ui @sign_in_ui do - if args.length > 0 then - @cmd.sign_in(*args) + if style == :param then + @cmd.sign_in host else @cmd.sign_in end @@ -223,3 +209,4 @@ class TestGemGemcutterUtilities < Gem::TestCase end end + |