aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_install_command.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-31 22:40:06 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-31 22:40:06 +0000
commit8cc45aae947d453acca029e13eb64f3f5f0bf942 (patch)
treef9485a20c99defe1aae3f32555a41d23c2298ad8 /test/rubygems/test_gem_commands_install_command.rb
parentdc8359969ec71ece10357ba9396430db7f029e45 (diff)
downloadruby-8cc45aae947d453acca029e13eb64f3f5f0bf942.tar.gz
Import RubyGems 1.1.0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_install_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb64
1 files changed, 36 insertions, 28 deletions
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 78840be8c6..101195a43e 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -34,25 +34,26 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
util_setup_fake_fetcher
@cmd.options[:domain] = :local
- gem1 = quick_gem 'gem_one'
- util_build_gem gem1
- FileUtils.mv File.join(@gemhome, 'cache', "#{@gem1.full_name}.gem"),
+ FileUtils.mv File.join(@gemhome, 'cache', "#{@a2.full_name}.gem"),
File.join(@tempdir)
- @cmd.options[:args] = [gem1.name]
+ @cmd.options[:args] = [@a2.name]
use_ui @ui do
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- @cmd.execute
+ e = 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 "Successfully installed #{@gem1.full_name}", out.shift
+ assert_equal "Successfully installed #{@a2.full_name}", out.shift
assert_equal "1 gem installed", out.shift
assert out.empty?, out.inspect
end
@@ -61,14 +62,17 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
util_setup_fake_fetcher
@cmd.options[:domain] = :local
- @cmd.options[:args] = %w[gem_one]
+ @cmd.options[:args] = %w[no_such_gem]
use_ui @ui do
- @cmd.execute
+ e = assert_raises Gem::SystemExitException do
+ @cmd.execute
+ end
+ assert_equal 2, e.exit_code
end
# HACK no repository was checked
- assert_equal "ERROR: could not find gem_one locally or in a repository\n",
+ assert_equal "ERROR: could not find no_such_gem locally or in a repository\n",
@ui.error
end
@@ -88,7 +92,10 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
@cmd.options[:args] = %w[nonexistent]
use_ui @ui do
- @cmd.execute
+ e = assert_raises Gem::SystemExitException do
+ @cmd.execute
+ end
+ assert_equal 2, e.exit_code
end
assert_equal "ERROR: could not find nonexistent locally or in a repository\n",
@@ -100,25 +107,27 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
@cmd.options[:generate_ri] = true
util_setup_fake_fetcher
- util_build_gem @gem1
@fetcher.data["#{@gem_repo}/Marshal.#{@marshal_version}"] =
@source_index.dump
- @fetcher.data["#{@gem_repo}/gems/gem_one-0.0.2.gem"] =
- File.read(File.join(@gemhome, 'cache', "#{@gem1.full_name}.gem"))
+ @fetcher.data["#{@gem_repo}/gems/#{@a2.full_name}.gem"] =
+ read_binary(File.join(@gemhome, 'cache', "#{@a2.full_name}.gem"))
- @cmd.options[:args] = [@gem1.name]
+ @cmd.options[:args] = [@a2.name]
use_ui @ui do
- @cmd.execute
+ e = assert_raises Gem::SystemExitException do
+ @cmd.execute
+ end
+ assert_equal 0, e.exit_code
end
out = @ui.output.split "\n"
assert_match %r|Bulk updating|, out.shift
- assert_equal "Successfully installed #{@gem1.full_name}", out.shift
+ assert_equal "Successfully installed #{@a2.full_name}", out.shift
assert_equal "1 gem installed", out.shift
- assert_equal "Installing ri documentation for #{@gem1.full_name}...",
+ assert_equal "Installing ri documentation for #{@a2.full_name}...",
out.shift
- assert_equal "Installing RDoc documentation for #{@gem1.full_name}...",
+ assert_equal "Installing RDoc documentation for #{@a2.full_name}...",
out.shift
assert out.empty?, out.inspect
end
@@ -127,31 +136,30 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
util_setup_fake_fetcher
@cmd.options[:domain] = :local
- gem1 = quick_gem 'gem_one'
- util_build_gem gem1
- FileUtils.mv File.join(@gemhome, 'cache', "#{@gem1.full_name}.gem"),
+ FileUtils.mv File.join(@gemhome, 'cache', "#{@a2.full_name}.gem"),
File.join(@tempdir)
- gem2 = quick_gem 'gem_two'
- util_build_gem gem2
- FileUtils.mv File.join(@gemhome, 'cache', "#{@gem2.full_name}.gem"),
+ FileUtils.mv File.join(@gemhome, 'cache', "#{@b2.full_name}.gem"),
File.join(@tempdir)
- @cmd.options[:args] = [gem1.name, gem2.name]
+ @cmd.options[:args] = [@a2.name, @b2.name]
use_ui @ui do
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- @cmd.execute
+ e = 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 "Successfully installed #{@gem1.full_name}", out.shift
- assert_equal "Successfully installed #{@gem2.full_name}", out.shift
+ assert_equal "Successfully installed #{@a2.full_name}", out.shift
+ assert_equal "Successfully installed #{@b2.full_name}", out.shift
assert_equal "2 gems installed", out.shift
assert out.empty?, out.inspect
end