From 9926b16d358f218776b8ae573ea775011fd367cd Mon Sep 17 00:00:00 2001 From: drbrain Date: Thu, 7 Mar 2013 04:06:30 +0000 Subject: * ChangeLog: * lib/rubygems/commands/setup_command.rb (class Gem): * lib/rubygems/commands/setup_command.rb (TEXT): * lib/rubygems/spec_fetcher.rb (class Gem): * lib/rubygems/test_utilities.rb (class Gem): * lib/rubygems.rb (module Gem): * test/rubygems/test_gem_commands_setup_command.rb (class TestGemCommandsSetupCommand): * test/rubygems/test_gem_spec_fetcher.rb (Upgraded http): git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rubygems/test_gem_commands_setup_command.rb | 19 +++++++++++++++++- test/rubygems/test_gem_spec_fetcher.rb | 25 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) (limited to 'test/rubygems') diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb index 9db6468337..86d5d0d4db 100644 --- a/test/rubygems/test_gem_commands_setup_command.rb +++ b/test/rubygems/test_gem_commands_setup_command.rb @@ -11,11 +11,17 @@ class TestGemCommandsSetupCommand < Gem::TestCase @cmd.options[:prefix] = @install_dir FileUtils.mkdir_p 'bin' - FileUtils.mkdir_p 'lib/rubygems' + FileUtils.mkdir_p 'lib/rubygems/ssl_certs' open 'bin/gem', 'w' do |io| io.puts '# gem' end open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end + open 'lib/rubygems/ssl_certs/foo.pem', 'w' do |io| io.puts 'PEM' end + end + + def test_pem_files_in + assert_equal %w[rubygems/ssl_certs/foo.pem], + @cmd.pem_files_in('lib').sort end def test_rb_files_in @@ -23,6 +29,17 @@ class TestGemCommandsSetupCommand < Gem::TestCase @cmd.rb_files_in('lib').sort end + def test_install_lib + @cmd.extend FileUtils + + Dir.mktmpdir 'lib' do |dir| + @cmd.install_lib dir + + assert_path_exists File.join(dir, 'rubygems.rb') + assert_path_exists File.join(dir, 'rubygems/ssl_certs/foo.pem') + end + end + def test_remove_old_lib_files lib = File.join @install_dir, 'lib' lib_rubygems = File.join lib, 'rubygems' diff --git a/test/rubygems/test_gem_spec_fetcher.rb b/test/rubygems/test_gem_spec_fetcher.rb index 51cdee7687..41d0ce4e26 100644 --- a/test/rubygems/test_gem_spec_fetcher.rb +++ b/test/rubygems/test_gem_spec_fetcher.rb @@ -287,5 +287,30 @@ Upgraded http://rubygems.org to HTTPS assert_equal expected, @ui.output end + def test_upgrade_http_source_rubygems_405 + Gem.configuration.verbose = :really + + source = Gem::Source.new URI 'http://rubygems.org' + https_source = nil + + @fetcher.data['https://rubygems.org/'] = proc do + raise Gem::RemoteFetcher::FetchError.new ' Not Allowed 405 ', nil + end + + use_ui @ui do + https_source = @sf.upgrade_http_source source + end + + assert_equal URI('https://rubygems.org'), https_source.uri + + assert_empty @ui.error + + expected = <<-EXPECTED +Upgraded http://rubygems.org to HTTPS + EXPECTED + + assert_equal expected, @ui.output + end + end -- cgit v1.2.3