From effdbf5936cc090a618e13c8f9a1b5412ebab2fa Mon Sep 17 00:00:00 2001 From: hsbt Date: Wed, 1 Jul 2015 21:50:14 +0000 Subject: * lib/rubygems: Update to RubyGems HEAD(c202db2). this version contains many enhancements see http://git.io/vtNwF * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rubygems/test_gem_installer.rb | 58 ++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'test/rubygems/test_gem_installer.rb') diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index 701fda15d4..2e5ac6ab76 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -36,7 +36,7 @@ class TestGemInstaller < Gem::InstallerTestCase require 'rubygems' -version = \">= 0\" +version = \">= 0.a\" if ARGV.first str = ARGV.first @@ -257,7 +257,7 @@ gem 'other', version s.add_dependency 'garbage ~> 5' end - installer = Gem::Installer.new a_gem + installer = Gem::Installer.at a_gem e = assert_raises Gem::InstallError do installer.ensure_loadable_spec @@ -275,7 +275,7 @@ gem 'other', version end policy = Gem::Security::HighSecurity - installer = Gem::Installer.new a_gem, :security_policy => policy + installer = Gem::Installer.at a_gem, :security_policy => policy assert_raises Gem::Security::Exception do installer.ensure_loadable_spec @@ -322,7 +322,7 @@ gem 'other', version :install_dir => "/non/existent" } - inst = Gem::Installer.new '', options + inst = Gem::Installer.at '', options Gem::Installer.path_warning = false @@ -575,8 +575,8 @@ gem 'other', version util_make_exec one = @spec.dup one.version = 1 + @installer = Gem::Installer.for_spec spec @installer.gem_dir = util_gem_dir one - @installer.spec = spec @installer.generate_bin @@ -672,14 +672,14 @@ gem 'other', version util_build_gem spec FileUtils.mv spec.cache_file, @tempdir - installer = Gem::Installer.new gem + installer = Gem::Installer.at gem assert_equal File.join(@gemhome, 'gems', spec.full_name), installer.gem_dir assert_equal File.join(@gemhome, 'bin'), installer.bin_dir end def test_initialize_user_install - installer = Gem::Installer.new @gem, :user_install => true + installer = Gem::Installer.at @gem, :user_install => true assert_equal File.join(Gem.user_dir, 'gems', @spec.full_name), installer.gem_dir @@ -688,7 +688,7 @@ gem 'other', version def test_initialize_user_install_bin_dir installer = - Gem::Installer.new @gem, :user_install => true, :bin_dir => @tempdir + Gem::Installer.at @gem, :user_install => true, :bin_dir => @tempdir assert_equal File.join(Gem.user_dir, 'gems', @spec.full_name), installer.gem_dir @@ -870,7 +870,7 @@ gem 'other', version Gem::Package.build @spec end end - @installer = Gem::Installer.new @gem + @installer = Gem::Installer.at @gem build_rake_in do use_ui @ui do assert_equal @spec, @installer.install @@ -884,7 +884,7 @@ gem 'other', version def test_install_force use_ui @ui do - installer = Gem::Installer.new old_ruby_required, :force => true + installer = Gem::Installer.at old_ruby_required, :force => true installer.install end @@ -993,7 +993,7 @@ gem 'other', version use_ui @ui do path = Gem::Package.build @spec - @installer = Gem::Installer.new path + @installer = Gem::Installer.at path @installer.install end @@ -1016,7 +1016,7 @@ gem 'other', version use_ui @ui do path = Gem::Package.build @spec - installer = Gem::Installer.new path, :install_dir => gemhome2 + installer = Gem::Installer.at path, :install_dir => gemhome2 installer.install end @@ -1056,7 +1056,7 @@ gem 'other', version use_ui @ui do path = Gem::Package.build @spec - @installer = Gem::Installer.new path + @installer = Gem::Installer.at path @installer.install end assert_path_exists File.join @spec.gem_dir, rb @@ -1097,7 +1097,7 @@ gem 'other', version use_ui @ui do path = Gem::Package.build @spec - @installer = Gem::Installer.new path + @installer = Gem::Installer.at path @installer.install end assert_path_exists so @@ -1175,7 +1175,7 @@ gem 'other', version # that it work everything out on it's own. Gem::Specification.reset - installer = Gem::Installer.new gem, :install_dir => gemhome2 + installer = Gem::Installer.at gem, :install_dir => gemhome2 build_rake_in do use_ui @ui do @@ -1186,7 +1186,7 @@ gem 'other', version def test_pre_install_checks_ruby_version use_ui @ui do - installer = Gem::Installer.new old_ruby_required + installer = Gem::Installer.at old_ruby_required e = assert_raises Gem::InstallError do installer.pre_install_checks end @@ -1205,7 +1205,7 @@ gem 'other', version gem = File.join(@gemhome, 'cache', spec.file_name) use_ui @ui do - @installer = Gem::Installer.new gem + @installer = Gem::Installer.at gem e = assert_raises Gem::InstallError do @installer.pre_install_checks end @@ -1231,7 +1231,7 @@ gem 'other', version def test_process_options_build_root build_root = File.join @tempdir, 'build_root' - @installer = Gem::Installer.new @gem, :build_root => build_root + @installer = Gem::Installer.at @gem, :build_root => build_root assert_equal Pathname(build_root), @installer.build_root assert_equal File.join(build_root, @gemhome, 'bin'), @installer.bin_dir @@ -1406,7 +1406,7 @@ gem 'other', version end def test_write_build_info_file_install_dir - installer = Gem::Installer.new @gem, :install_dir => "#{@gemhome}2" + installer = Gem::Installer.at @gem, :install_dir => "#{@gemhome}2" installer.build_args = %w[ --with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4 @@ -1426,8 +1426,7 @@ gem 'other', version FileUtils.mv cache_file, gem refute_path_exists cache_file - installer = Gem::Installer.new gem - installer.spec = @spec + installer = Gem::Installer.at gem installer.gem_home = @gemhome installer.write_cache_file @@ -1439,7 +1438,7 @@ gem 'other', version FileUtils.rm @spec.spec_file refute_path_exists @spec.spec_file - @installer.spec = @spec + @installer = Gem::Installer.for_spec @spec @installer.gem_home = @gemhome @installer.write_spec @@ -1459,7 +1458,7 @@ gem 'other', version @spec.files = %w[a.rb b.rb c.rb] - @installer.spec = @spec + @installer = Gem::Installer.for_spec @spec @installer.gem_home = @gemhome @installer.write_spec @@ -1474,6 +1473,13 @@ gem 'other', version assert_match %r!/gemhome/gems/a-2$!, @installer.dir end + def test_default_gem_loaded_from + spec = util_spec 'a' + installer = Gem::Installer.for_spec spec, :install_as_default => true + installer.install + assert_predicate spec, :default_gem? + end + def test_default_gem FileUtils.rm_f File.join(Gem.dir, 'specifications') @@ -1490,10 +1496,10 @@ gem 'other', version installed_exec = File.join util_inst_bindir, 'executable' assert_path_exists installed_exec - assert File.directory? File.join(Gem.dir, 'specifications') - assert File.directory? File.join(Gem.dir, 'specifications', 'default') + assert File.directory? File.join(Gem.default_dir, 'specifications') + assert File.directory? File.join(Gem.default_dir, 'specifications', 'default') - default_spec = eval File.read File.join(Gem.dir, 'specifications', 'default', 'a-2.gemspec') + default_spec = eval File.read File.join(Gem.default_dir, 'specifications', 'default', 'a-2.gemspec') assert_equal Gem::Version.new("2"), default_spec.version assert_equal ['bin/executable'], default_spec.files end -- cgit v1.2.3