diff options
Diffstat (limited to 'test/rubygems/test_gem_install_update_options.rb')
-rw-r--r-- | test/rubygems/test_gem_install_update_options.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb index 3f63896999..de09d7a171 100644 --- a/test/rubygems/test_gem_install_update_options.rb +++ b/test/rubygems/test_gem_install_update_options.rb @@ -17,6 +17,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase def test_add_install_update_options args = %w[ --document + --build-root build_root --format-exec --ignore-dependencies --rdoc @@ -25,6 +26,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase -f -i /install_to -w + --vendor ] args.concat %w[-P HighSecurity] if defined?(OpenSSL::SSL) @@ -32,6 +34,12 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase assert @cmd.handles?(args) end + def test_build_root + @cmd.handle_options %w[--build-root build_root] + + assert_equal File.expand_path('build_root'), @cmd.options[:build_root] + end + def test_doc @cmd.handle_options %w[--doc] @@ -147,4 +155,30 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase ensure FileUtils.chmod 0755, @gemhome end + + def test_vendor + @cmd.handle_options %w[--vendor] + + assert @cmd.options[:vendor] + assert_equal Gem.vendor_dir, @cmd.options[:install_dir] + 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 + + refute @cmd.options[:vendor] + refute @cmd.options[:install_dir] + + ensure + RbConfig::CONFIG['vendordir'] = orig_vendordir + end + end |