diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/rubygems/test_gem_command.rb | 12 | ||||
| -rw-r--r-- | test/rubygems/test_gem_commands_help_command.rb | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb index a99de30b33..4d0c4eb5e8 100644 --- a/test/rubygems/test_gem_command.rb +++ b/test/rubygems/test_gem_command.rb @@ -189,6 +189,18 @@ class TestGemCommand < Gem::TestCase assert_match %r{Usage: gem doit}, @ui.output end + def test_add_option + assert_nothing_raised RuntimeError do + @cmd.add_option('--force', 'skip validation of the spec') {|v,o| } + end + end + + def test_add_option_with_empty + assert_raise RuntimeError, "Do not pass an empty string in opts" do + @cmd.add_option('', 'skip validation of the spec') {|v,o| } + end + end + def test_option_recognition @cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options| options[:help] = true diff --git a/test/rubygems/test_gem_commands_help_command.rb b/test/rubygems/test_gem_commands_help_command.rb index 24cf2d2250..128db5db1f 100644 --- a/test/rubygems/test_gem_commands_help_command.rb +++ b/test/rubygems/test_gem_commands_help_command.rb @@ -35,6 +35,13 @@ class TestGemCommandsHelpCommand < Gem::TestCase end end + def test_gem_help_build + util_gem 'build' do |out, err| + assert_match(/-C PATH *Run as if gem build was started in <PATH>/, out) + assert_equal '', err + end + end + def test_gem_help_commands mgr = Gem::CommandManager.new |
