diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-01 09:41:32 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-01 09:41:32 +0000 |
commit | 25a9b62d45ddd60a231272567c7dda9337da9b62 (patch) | |
tree | e72ba4c9c01cba5fb510eb1eafaba76d998baf4c /test/rubygems/test_gem_commands_push_command.rb | |
parent | 86bb0af7ea3b50f72e6845a6f5f64cb1b23fd279 (diff) |
Import rubygems 1.6.0 (released version @ 58d8a0b9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_push_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_push_command.rb | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb index b95af2380b..917407dc32 100644 --- a/test/rubygems/test_gem_commands_push_command.rb +++ b/test/rubygems/test_gem_commands_push_command.rb @@ -7,16 +7,28 @@ require 'rubygems/test_case' require 'rubygems/commands/push_command' +module Gem + class << self; remove_method :latest_rubygems_version; end + + def self.latest_rubygems_version + Gem::Version.new Gem::VERSION + end +end + class TestGemCommandsPushCommand < Gem::TestCase def setup super - @gems_dir = File.join @tempdir, 'gems' - @cache_dir = File.join @gemhome, 'cache' + @gems_dir = File.join @tempdir, 'gems' + @cache_dir = Gem.cache_dir @gemhome + FileUtils.mkdir @gems_dir - Gem.configuration.rubygems_api_key = "ed244fbf2b1a52e012da8616c512fa47f9aa5250" - @spec, @path = util_gem("freewill", "1.0.0") + + Gem.configuration.rubygems_api_key = + "ed244fbf2b1a52e012da8616c512fa47f9aa5250" + + @spec, @path = util_gem "freewill", "1.0.0" @fetcher = Gem::FakeFetcher.new Gem::RemoteFetcher.fetcher = @fetcher @@ -83,5 +95,19 @@ class TestGemCommandsPushCommand < Gem::TestCase assert_match response, @ui.output end -end + def test_sending_gem_key + @response = "Successfully registered gem: freewill (1.0.0)" + @fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, "OK"] + File.open Gem.configuration.credentials_path, 'a' do |f| + f.write ':other: 701229f217cdf23b1344c7b4b54ca97' + end + Gem.configuration.load_api_keys + + @cmd.handle_options %w(-k other) + @cmd.send_gem(@path) + assert_equal Gem.configuration.api_keys[:other], + @fetcher.last_request["Authorization"] + end + +end |