summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_install_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_commands_install_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb39
1 files changed, 21 insertions, 18 deletions
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index a3ceb81ab7..adc66aa911 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -7,6 +7,12 @@
require 'rubygems/test_case'
require 'rubygems/commands/install_command'
+begin
+ gem "rdoc"
+rescue Gem::LoadError
+ # ignore
+end
+
class TestGemCommandsInstallCommand < Gem::TestCase
def setup
@@ -22,9 +28,9 @@ class TestGemCommandsInstallCommand < Gem::TestCase
util_setup_spec_fetcher @a2, @a2_pre
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(File.join(@gemhome, 'cache', @a2.file_name))
+ read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- read_binary(File.join(@gemhome, 'cache', @a2_pre.file_name))
+ read_binary(Gem.cache_gem(@a2_pre.file_name, @gemhome))
@cmd.options[:args] = [@a2.name]
@@ -44,11 +50,12 @@ class TestGemCommandsInstallCommand < Gem::TestCase
util_setup_spec_fetcher @a2, @a2_pre
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(File.join(@gemhome, 'cache', @a2.file_name))
+ read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- read_binary(File.join(@gemhome, 'cache', @a2_pre.file_name))
+ read_binary(Gem.cache_gem(@a2_pre.file_name, @gemhome))
- @cmd.handle_options [@a2_pre.name, '--version', @a2_pre.version.to_s]
+ @cmd.handle_options [@a2_pre.name, '--version', @a2_pre.version.to_s,
+ "--no-ri", "--no-rdoc"]
assert @cmd.options[:prerelease]
assert @cmd.options[:version].satisfied_by?(@a2_pre.version)
@@ -85,8 +92,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
util_setup_fake_fetcher
@cmd.options[:domain] = :local
- FileUtils.mv File.join(@gemhome, 'cache', @a2.file_name),
- File.join(@tempdir)
+ FileUtils.mv Gem.cache_gem(@a2.file_name, @gemhome), @tempdir
@cmd.options[:args] = [@a2.name]
@@ -115,8 +121,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
util_setup_fake_fetcher
@cmd.options[:user_install] = false
- FileUtils.mv File.join(@gemhome, 'cache', @a2.file_name),
- File.join(@tempdir)
+ FileUtils.mv Gem.cache_gem(@a2.file_name, @gemhome), @tempdir
@cmd.options[:args] = [@a2.name]
@@ -183,7 +188,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
correctly_spelled = "non_existent_with_hint"
util_setup_fake_fetcher
- util_setup_spec_fetcher quick_gem(correctly_spelled, '2')
+ util_setup_spec_fetcher quick_spec(correctly_spelled, '2')
@cmd.options[:args] = [misspelled]
@@ -207,9 +212,9 @@ ERROR: Possible alternatives: non_existent_with_hint
util_setup_spec_fetcher @a2, @a2_pre
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(File.join(@gemhome, 'cache', @a2.file_name))
+ read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- read_binary(File.join(@gemhome, 'cache', @a2_pre.file_name))
+ read_binary(Gem.cache_gem(@a2_pre.file_name, @gemhome))
@cmd.options[:prerelease] = true
@cmd.options[:args] = [@a2_pre.name]
@@ -233,7 +238,7 @@ ERROR: Possible alternatives: non_existent_with_hint
util_setup_spec_fetcher @a2
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(File.join(@gemhome, 'cache', @a2.file_name))
+ read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
@cmd.options[:args] = [@a2.name]
@@ -260,11 +265,9 @@ ERROR: Possible alternatives: non_existent_with_hint
util_setup_fake_fetcher
@cmd.options[:domain] = :local
- FileUtils.mv File.join(@gemhome, 'cache', @a2.file_name),
- File.join(@tempdir)
+ FileUtils.mv Gem.cache_gem(@a2.file_name, @gemhome), @tempdir
- FileUtils.mv File.join(@gemhome, 'cache', @b2.file_name),
- File.join(@tempdir)
+ FileUtils.mv Gem.cache_gem(@b2.file_name, @gemhome), @tempdir
@cmd.options[:args] = [@a2.name, @b2.name]
@@ -293,7 +296,7 @@ ERROR: Possible alternatives: non_existent_with_hint
util_setup_spec_fetcher @b2
@fetcher.data["#{@gem_repo}gems/#{@b2.file_name}"] =
- read_binary(File.join(@gemhome, 'cache', @b2.file_name))
+ read_binary(Gem.cache_gem(@b2.file_name, @gemhome))
uninstall_gem(@b2)