diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-06-01 12:45:11 +0300 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-06-01 13:50:41 +0300 |
commit | 56660de3c6df7a4ff8667ef4047d30d0de169935 (patch) | |
tree | dd1e526075687b4b24e089cee50eabc21a6143cc /lib/rubygems/installer_test_case.rb | |
parent | 560cd5b1f04f30542a294b3d77527d3b12f7cc15 (diff) | |
download | ruby-56660de3c6df7a4ff8667ef4047d30d0de169935.tar.gz |
Merge rubygems master from upstream.
I picked the commit from 3c469e0da538428a0ddd94f99aa73c32da22e8ba
Diffstat (limited to 'lib/rubygems/installer_test_case.rb')
-rw-r--r-- | lib/rubygems/installer_test_case.rb | 116 |
1 files changed, 79 insertions, 37 deletions
diff --git a/lib/rubygems/installer_test_case.rb b/lib/rubygems/installer_test_case.rb index 1c16959f5f..f48466d3ea 100644 --- a/lib/rubygems/installer_test_case.rb +++ b/lib/rubygems/installer_test_case.rb @@ -66,44 +66,9 @@ end class Gem::InstallerTestCase < Gem::TestCase - ## - # Creates the following instance variables: - # - # @spec:: - # a spec named 'a', intended for regular installs - # @user_spec:: - # a spec named 'b', intended for user installs - # - # @gem:: - # the path to a built gem from @spec - # @user_spec:: - # the path to a built gem from @user_spec - # - # @installer:: - # a Gem::Installer for the @spec that installs into @gemhome - # @user_installer:: - # a Gem::Installer for the @user_spec that installs into Gem.user_dir - def setup super - @spec = quick_gem 'a' do |spec| - util_make_exec spec - end - - @user_spec = quick_gem 'b' do |spec| - util_make_exec spec - end - - util_build_gem @spec - util_build_gem @user_spec - - @gem = @spec.cache_file - @user_gem = @user_spec.cache_file - - @installer = util_installer @spec, @gemhome - @user_installer = util_installer @user_spec, Gem.user_dir, :user - Gem::Installer.path_warning = false end @@ -136,6 +101,83 @@ class Gem::InstallerTestCase < Gem::TestCase end ## + # Creates the following instance variables: + # + # @spec:: + # a spec named 'a', intended for regular installs + # + # @gem:: + # the path to a built gem from @spec + # + # And returns a Gem::Installer for the @spec that installs into @gemhome + + def setup_base_installer + @gem = setup_base_gem + util_installer @spec, @gemhome + end + + ## + # Creates the following instance variables: + # + # @spec:: + # a spec named 'a', intended for regular installs + # + # And returns a gem built for the @spec + + def setup_base_gem + @spec = setup_base_spec + util_build_gem @spec + @spec.cache_file + end + + ## + # Sets up a generic specification for testing the rubygems installer + # + # And returns it + + def setup_base_spec + quick_gem 'a' do |spec| + util_make_exec spec + end + end + + ## + # Creates the following instance variables: + # + # @spec:: + # a spec named 'a', intended for regular installs + # @user_spec:: + # a spec named 'b', intended for user installs + # + # @gem:: + # the path to a built gem from @spec + # @user_gem:: + # the path to a built gem from @user_spec + # + # And returns a Gem::Installer for the @user_spec that installs into Gem.user_dir + + def setup_base_user_installer + @user_spec = quick_gem 'b' do |spec| + util_make_exec spec + end + + util_build_gem @user_spec + + @user_gem = @user_spec.cache_file + + util_installer @user_spec, Gem.user_dir, :user + end + + ## + # Sets up the base @gem, builds it and returns an installer for it. + # + def util_setup_installer + @gem = setup_base_gem + + util_setup_gem + end + + ## # Builds the @spec gem and returns an installer for it. The built gem # includes: # @@ -143,7 +185,7 @@ class Gem::InstallerTestCase < Gem::TestCase # lib/code.rb # ext/a/mkrf_conf.rb - def util_setup_gem(ui = @ui) # HACK fix use_ui to make this automatic + def util_setup_gem(ui = @ui) @spec.files << File.join('lib', 'code.rb') @spec.extensions << File.join('ext', 'a', 'mkrf_conf.rb') @@ -175,7 +217,7 @@ class Gem::InstallerTestCase < Gem::TestCase end end - @installer = Gem::Installer.at @gem + Gem::Installer.at @gem end ## |