diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
commit | d22130922e7842226d38d59680e4bbb48a28a5f0 (patch) | |
tree | 39594d3a14641dd5488a99a5e633239296fa5742 /test/rubygems/test_gem_commands_help_command.rb | |
parent | 4752539e3f3e563d559732c52424206bd6f12dbd (diff) |
Import rubygems 1.8.5 (released @ 137c80f)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_help_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_help_command.rb | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_help_command.rb b/test/rubygems/test_gem_commands_help_command.rb new file mode 100644 index 0000000000..acfc2daefc --- /dev/null +++ b/test/rubygems/test_gem_commands_help_command.rb @@ -0,0 +1,64 @@ +###################################################################### +# This file is imported from the rubygems project. +# DO NOT make modifications in this repo. They _will_ be reverted! +# File a patch instead and assign it to Ryan Davis or Eric Hodel. +###################################################################### + +require "rubygems" +require "rubygems/test_case" +require "rubygems/commands/help_command" +require "rubygems/format" +require "rubygems/command_manager" + +class TestGemCommandsHelpCommand < Gem::TestCase + def setup + super + + @cmd = Gem::Commands::HelpCommand.new + end + + def test_gem_help_bad + util_gem 'bad' do |out, err| + assert_equal('', out) + assert_match(/Unknown command bad. Try gem help commands\n/, err) + end + end + + def test_gem_help_platforms + util_gem 'platforms' do |out, err| + assert_match(/x86-freebsd/, out) + assert_equal '', err + end + end + + def test_gem_help_commands + mgr = Gem::CommandManager.new + + util_gem 'commands' do |out, err| + mgr.command_names.each do |cmd| + assert_match(/\s+#{cmd}\s+\S+/, out) + end + assert_equal '', err + end + end + + def test_gem_no_args_shows_help + util_gem do |out, err| + assert_match(/Usage:/, out) + assert_match(/gem install/, out) + assert_equal '', err + end + end + + def util_gem *args + @cmd.options[:args] = args + + use_ui @ui do + Dir.chdir @tempdir do + @cmd.execute + end + end + + yield @ui.output, @ui.error + end +end |