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.rb49
1 files changed, 25 insertions, 24 deletions
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index adc66aa..522731b 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -24,13 +24,13 @@ class TestGemCommandsInstallCommand < Gem::TestCase
end
def test_execute_exclude_prerelease
- util_setup_fake_fetcher(:prerelease)
- util_setup_spec_fetcher @a2, @a2_pre
+ util_setup_fake_fetcher :prerelease
+ util_setup_spec_fetcher
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
+ read_binary(@a2.cache_file)
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- read_binary(Gem.cache_gem(@a2_pre.file_name, @gemhome))
+ read_binary(@a2_pre.cache_file)
@cmd.options[:args] = [@a2.name]
@@ -46,13 +46,13 @@ class TestGemCommandsInstallCommand < Gem::TestCase
end
def test_execute_explicit_version_includes_prerelease
- util_setup_fake_fetcher(:prerelease)
- util_setup_spec_fetcher @a2, @a2_pre
+ util_setup_fake_fetcher :prerelease
+ util_setup_spec_fetcher
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
+ read_binary(@a2.cache_file)
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- read_binary(Gem.cache_gem(@a2_pre.file_name, @gemhome))
+ read_binary(@a2_pre.cache_file)
@cmd.handle_options [@a2_pre.name, '--version', @a2_pre.version.to_s,
"--no-ri", "--no-rdoc"]
@@ -92,7 +92,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
util_setup_fake_fetcher
@cmd.options[:domain] = :local
- FileUtils.mv Gem.cache_gem(@a2.file_name, @gemhome), @tempdir
+ FileUtils.mv @a2.cache_file, @tempdir
@cmd.options[:args] = [@a2.name]
@@ -121,15 +121,15 @@ class TestGemCommandsInstallCommand < Gem::TestCase
util_setup_fake_fetcher
@cmd.options[:user_install] = false
- FileUtils.mv Gem.cache_gem(@a2.file_name, @gemhome), @tempdir
+ FileUtils.mv @a2.cache_file, @tempdir
@cmd.options[:args] = [@a2.name]
use_ui @ui do
orig_dir = Dir.pwd
begin
- File.chmod 0755, @userhome
- File.chmod 0555, @gemhome
+ FileUtils.chmod 0755, @userhome
+ FileUtils.chmod 0555, @gemhome
Dir.chdir @tempdir
assert_raises Gem::FilePermissionError do
@@ -137,7 +137,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
end
ensure
Dir.chdir orig_dir
- File.chmod 0755, @gemhome
+ FileUtils.chmod 0755, @gemhome
end
end
end
@@ -208,13 +208,14 @@ ERROR: Possible alternatives: non_existent_with_hint
end
def test_execute_prerelease
- util_setup_fake_fetcher(:prerelease)
+ util_setup_fake_fetcher :prerelease
+ util_clear_gems
util_setup_spec_fetcher @a2, @a2_pre
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
+ read_binary(@a2.cache_file)
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
- read_binary(Gem.cache_gem(@a2_pre.file_name, @gemhome))
+ read_binary(@a2_pre.cache_file)
@cmd.options[:prerelease] = true
@cmd.options[:args] = [@a2_pre.name]
@@ -235,10 +236,10 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:generate_ri] = true
util_setup_fake_fetcher
- util_setup_spec_fetcher @a2
+ util_setup_spec_fetcher
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
- read_binary(Gem.cache_gem(@a2.file_name, @gemhome))
+ read_binary(@a2.cache_file)
@cmd.options[:args] = [@a2.name]
@@ -265,9 +266,9 @@ ERROR: Possible alternatives: non_existent_with_hint
util_setup_fake_fetcher
@cmd.options[:domain] = :local
- FileUtils.mv Gem.cache_gem(@a2.file_name, @gemhome), @tempdir
+ FileUtils.mv @a2.cache_file, @tempdir
- FileUtils.mv Gem.cache_gem(@b2.file_name, @gemhome), @tempdir
+ FileUtils.mv @b2.cache_file, @tempdir
@cmd.options[:args] = [@a2.name, @b2.name]
@@ -293,10 +294,10 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_conservative
util_setup_fake_fetcher
- util_setup_spec_fetcher @b2
+ util_setup_spec_fetcher
@fetcher.data["#{@gem_repo}gems/#{@b2.file_name}"] =
- read_binary(Gem.cache_gem(@b2.file_name, @gemhome))
+ read_binary(@b2.cache_file)
uninstall_gem(@b2)
@@ -308,16 +309,16 @@ ERROR: Possible alternatives: non_existent_with_hint
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::SystemExitException do
@cmd.execute
end
- assert_equal 0, e.exit_code
ensure
Dir.chdir orig_dir
end
end
out = @ui.output.split "\n"
+ assert_equal "", @ui.error
assert_equal "Successfully installed #{@b2.full_name}", out.shift
assert_equal "1 gem installed", out.shift
assert out.empty?, out.inspect