aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_installer.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-14 03:30:02 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-14 03:30:02 +0000
commit4de117a61517e839f2c45eaf45d56fc243d6d5b2 (patch)
tree7cb5af7a7eb513e5dddf5e343746b1611e628387 /test/rubygems/test_gem_installer.rb
parente548c09d429a5136285ea81aed418685359ed124 (diff)
downloadruby-4de117a61517e839f2c45eaf45d56fc243d6d5b2.tar.gz
* lib/rubygems: Update to RubyGems 2.4.1 master(713ab65)
Complete history at: https://github.com/rubygems/rubygems/blob/master/History.txt#L3-L216 * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_installer.rb')
-rw-r--r--test/rubygems/test_gem_installer.rb83
1 files changed, 82 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index eff62ab28b..6f8012feb8 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -188,6 +188,56 @@ gem 'other', version
assert_match %r|generated by RubyGems|, wrapper
end unless Gem.win_platform?
+ def test_check_that_user_bin_dir_is_in_path
+ bin_dir = @installer.bin_dir
+
+ if Gem.win_platform?
+ bin_dir = bin_dir.downcase.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
+ end
+
+ orig_PATH, ENV['PATH'] =
+ ENV['PATH'], [ENV['PATH'], bin_dir].join(File::PATH_SEPARATOR)
+
+ use_ui @ui do
+ @installer.check_that_user_bin_dir_is_in_path
+ end
+
+ assert_empty @ui.error
+ ensure
+ ENV['PATH'] = orig_PATH
+ end
+
+ def test_check_that_user_bin_dir_is_in_path_tilde
+ skip "Tilde is PATH is not supported under MS Windows" if win_platform?
+
+ orig_PATH, ENV['PATH'] =
+ ENV['PATH'], [ENV['PATH'], '~/bin'].join(File::PATH_SEPARATOR)
+
+ @installer.bin_dir.replace File.join @userhome, 'bin'
+
+ use_ui @ui do
+ @installer.check_that_user_bin_dir_is_in_path
+ end
+
+ assert_empty @ui.error
+ ensure
+ ENV['PATH'] = orig_PATH unless win_platform?
+ end
+
+ def test_check_that_user_bin_dir_is_in_path_not_in_path
+ use_ui @ui do
+ @installer.check_that_user_bin_dir_is_in_path
+ end
+
+ expected = @installer.bin_dir
+
+ if Gem.win_platform? then
+ expected = expected.downcase.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
+ end
+
+ assert_match expected, @ui.error
+ end
+
def test_ensure_dependency
util_spec 'a'
@@ -574,6 +624,9 @@ gem 'other', version
def test_generate_bin_symlink_win32
old_win_platform = Gem.win_platform?
Gem.win_platform = true
+ old_alt_separator = File::ALT_SEPARATOR
+ File.__send__(:remove_const, :ALT_SEPARATOR)
+ File.const_set(:ALT_SEPARATOR, '\\')
@installer.wrappers = false
util_make_exec
@installer.gem_dir = util_gem_dir
@@ -592,6 +645,8 @@ gem 'other', version
wrapper = File.read installed_exec
assert_match(/generated by RubyGems/, wrapper)
ensure
+ File.__send__(:remove_const, :ALT_SEPARATOR)
+ File.const_set(:ALT_SEPARATOR, old_alt_separator)
Gem.win_platform = old_win_platform
end
@@ -1053,7 +1108,7 @@ gem 'other', version
path = File.join(@gemhome, 'gems', 'a-2', 'gem_make.out')
- if File.exists?(path)
+ if File.exist?(path)
puts File.read(path)
puts '-' * 78
end
@@ -1071,6 +1126,16 @@ gem 'other', version
refute @installer.installation_satisfies_dependency?(dep)
end
+ def test_installation_satisfies_dependency_eh_development
+ @installer.options[:development] = true
+ @installer.options[:dev_shallow] = true
+
+ util_spec 'a'
+
+ dep = Gem::Dependency.new 'a', :development
+ assert @installer.installation_satisfies_dependency?(dep)
+ end
+
def test_pre_install_checks_dependencies
@spec.add_dependency 'b', '> 5'
util_setup_gem
@@ -1157,6 +1222,22 @@ gem 'other', version
assert_equal "#!#{Gem.ruby}", shebang
end
+ def test_process_options
+ assert_nil @installer.build_root
+ assert_equal File.join(@gemhome, 'bin'), @installer.bin_dir
+ assert_equal @gemhome, @installer.gem_home
+ end
+
+ def test_process_options_build_root
+ build_root = File.join @tempdir, 'build_root'
+
+ @installer = Gem::Installer.new @gem, :build_root => build_root
+
+ assert_equal Pathname(build_root), @installer.build_root
+ assert_equal File.join(build_root, @gemhome, 'bin'), @installer.bin_dir
+ assert_equal File.join(build_root, @gemhome), @installer.gem_home
+ end
+
def test_shebang_arguments
util_make_exec @spec, "#!/usr/bin/ruby -ws"