summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/test_gem.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 242d0cee60..f5bfa28e54 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -11,7 +11,11 @@ class TestGem < RubyGemTestCase
super
@additional = %w[a b].map { |d| File.join @tempdir, d }
- @default_dir_re = %r|/\.*?[Rr]uby.*?/[Gg]ems/[0-9.]+|
+ @default_dir_re = if RUBY_VERSION > '1.9' then
+ %r|/.*?[Rr]uby.*?/[Gg]ems/[0-9.]+|
+ else
+ %r|/[Rr]uby/[Gg]ems/[0-9.]+|
+ end
end
def test_self_all_load_paths
@@ -475,6 +479,27 @@ class TestGem < RubyGemTestCase
assert_kind_of Gem::GemPathSearcher, Gem.searcher
end
+ def test_self_set_paths
+ other = File.join @tempdir, 'other'
+ path = [@userhome, other].join File::PATH_SEPARATOR
+ Gem.send :set_paths, path
+
+ assert File.exist?(File.join(@userhome, 'gems'))
+ assert File.exist?(File.join(other, 'gems'))
+ end
+
+ def test_self_set_paths_nonexistent_home
+ Gem.clear_paths
+
+ other = File.join @tempdir, 'other'
+
+ ENV['HOME'] = other
+
+ Gem.send :set_paths, other
+
+ refute File.exist?(File.join(other, 'gems'))
+ end
+
def test_self_source_index
assert_kind_of Gem::SourceIndex, Gem.source_index
end