From 56660de3c6df7a4ff8667ef4047d30d0de169935 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Sat, 1 Jun 2019 12:45:11 +0300 Subject: Merge rubygems master from upstream. I picked the commit from 3c469e0da538428a0ddd94f99aa73c32da22e8ba --- test/rubygems/test_gem_install_update_options.rb | 47 +++++++++++++++--------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'test/rubygems/test_gem_install_update_options.rb') diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb index dd6bd08dde..c6b4778336 100644 --- a/test/rubygems/test_gem_install_update_options.rb +++ b/test/rubygems/test_gem_install_update_options.rb @@ -26,10 +26,11 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase -f -i /install_to -w - --vendor --post-install-message ] + args.concat %w[--vendor] unless Gem.java_platform? + args.concat %w[-P HighSecurity] if defined?(OpenSSL::SSL) assert @cmd.handles?(args) @@ -111,6 +112,13 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase end def test_user_install_enabled + @spec = quick_gem 'a' do |spec| + util_make_exec spec + end + + util_build_gem @spec + @gem = @spec.cache_file + @cmd.handle_options %w[--user-install] assert @cmd.options[:user_install] @@ -122,6 +130,13 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase end def test_user_install_disabled_read_only + @spec = quick_gem 'a' do |spec| + util_make_exec spec + end + + util_build_gem @spec + @gem = @spec.cache_file + if win_platform? skip('test_user_install_disabled_read_only test skipped on MS Windows') elsif Process.uid.zero? @@ -145,28 +160,26 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase end def test_vendor - @cmd.handle_options %w[--vendor] + vendordir(File.join(@tempdir, 'vendor')) do + @cmd.handle_options %w[--vendor] - assert @cmd.options[:vendor] - assert_equal Gem.vendor_dir, @cmd.options[:install_dir] + assert @cmd.options[:vendor] + assert_equal Gem.vendor_dir, @cmd.options[:install_dir] + end end def test_vendor_missing - orig_vendordir = RbConfig::CONFIG['vendordir'] - RbConfig::CONFIG.delete 'vendordir' - - e = assert_raises OptionParser::InvalidOption do - @cmd.handle_options %w[--vendor] - end - - assert_equal 'invalid option: --vendor your platform is not supported', - e.message + vendordir(nil) do + e = assert_raises OptionParser::InvalidOption do + @cmd.handle_options %w[--vendor] + end - refute @cmd.options[:vendor] - refute @cmd.options[:install_dir] + assert_equal 'invalid option: --vendor your platform is not supported', + e.message - ensure - RbConfig::CONFIG['vendordir'] = orig_vendordir + refute @cmd.options[:vendor] + refute @cmd.options[:install_dir] + end end def test_post_install_message_no -- cgit v1.2.3