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 /test/rubygems/test_gem_install_update_options.rb | |
parent | 560cd5b1f04f30542a294b3d77527d3b12f7cc15 (diff) | |
download | ruby-56660de3c6df7a4ff8667ef4047d30d0de169935.tar.gz |
Merge rubygems master from upstream.
I picked the commit from 3c469e0da538428a0ddd94f99aa73c32da22e8ba
Diffstat (limited to 'test/rubygems/test_gem_install_update_options.rb')
-rw-r--r-- | test/rubygems/test_gem_install_update_options.rb | 47 |
1 files changed, 30 insertions, 17 deletions
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 |