aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_install_update_options.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-26 02:06:00 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-26 02:06:00 +0000
commit8b424513fd43c398aaeea5dede8bbc5c51602773 (patch)
treeb1509d7a77a52206f7825520c99a693f7818a8a4 /test/rubygems/test_gem_install_update_options.rb
parentdbf3fb3d8e6e10e2ac2af19937e0016a4815ca50 (diff)
downloadruby-8b424513fd43c398aaeea5dede8bbc5c51602773.tar.gz
Upgrade to RubyGems 1.2.0 r1824. Incorporates [ruby-core:17353].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_install_update_options.rb')
-rw-r--r--test/rubygems/test_gem_install_update_options.rb31
1 files changed, 26 insertions, 5 deletions
diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb
index 8c7a5ce3f7..3638a0670a 100644
--- a/test/rubygems/test_gem_install_update_options.rb
+++ b/test/rubygems/test_gem_install_update_options.rb
@@ -1,20 +1,21 @@
require 'test/unit'
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
+require File.join(File.expand_path(File.dirname(__FILE__)),
+ 'gem_installer_test_case')
require 'rubygems/install_update_options'
require 'rubygems/command'
-class TestGemInstallUpdateOptions < RubyGemTestCase
+class TestGemInstallUpdateOptions < GemInstallerTestCase
def setup
super
@cmd = Gem::Command.new 'dummy', 'dummy'
@cmd.extend Gem::InstallUpdateOptions
+ @cmd.add_install_update_options
end
def test_add_install_update_options
- @cmd.add_install_update_options
-
args = %w[-i /install_to --rdoc --ri -E -f -t -w -P HighSecurity
--ignore-dependencies --format-exec --include-dependencies]
@@ -22,8 +23,6 @@ class TestGemInstallUpdateOptions < RubyGemTestCase
end
def test_security_policy
- @cmd.add_install_update_options
-
@cmd.handle_options %w[-P HighSecurity]
assert_equal Gem::Security::HighSecurity, @cmd.options[:security_policy]
@@ -37,4 +36,26 @@ class TestGemInstallUpdateOptions < RubyGemTestCase
end
end
+ def test_user_install_enabled
+ @cmd.handle_options %w[--user-install]
+
+ @installer = Gem::Installer.new @gem, @cmd.options
+ @installer.install
+ assert File.exist?(File.join(@userhome, '.gem', 'gems'))
+ assert File.exist?(File.join(@userhome, '.gem', 'gems',
+ @spec.full_name))
+ end
+
+ def test_user_install_disabled_read_only
+ @cmd.handle_options %w[--no-user-install]
+
+ File.chmod 0755, @userhome
+ FileUtils.chmod 0000, @gemhome
+
+ assert_raises(Gem::FilePermissionError) do
+ @installer = Gem::Installer.new @gem, @cmd.options
+ end
+ ensure
+ FileUtils.chmod 0755, @gemhome
+ end
end