Sha256: b591ff9216ab2d48929402eb169422e19cd9cda6ee25015da9219692a7954ffe
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require "#{File.expand_path(File.join(File.dirname(__FILE__), "helper.rb"))}" class TestSubCommand < MiniTest::Unit::TestCase def setup require 'helpers/subcommand.rb' @commands = Commandeer.commands end def test_has_command assert_includes(@commands.keys, "fakeparent") end def test_has_subcommands assert_includes(@commands['fakeparent'].keys, 'subcommands') end def test_has_subcommand assert_includes(@commands['fakeparent']['subcommands'].keys, 'bar') end def test_subcommand_has_parser assert(@commands['fakeparent']['subcommands']['bar'][:parser], "parse") end def test_has_klass assert(@commands['fakeparent']['subcommands']['bar'][:klass], "SubCommand") end def test_output_noopts out, err = capture_io do begin Commandeer.parse! '' rescue SystemExit end end assert_match(out, /^.*Usage.*\n\n\tfakeparent\tSubcommands:\t bar.*$/) end def test_output_fakeparent out, err = capture_io do begin Commandeer.parse! %w{fakeparent} rescue SystemExit end end assert_match(out, /`fakeparent` has the following registered subcommands:\n\tbar.*$/) end def test_output_bar_options out, err = capture_io do begin Commandeer.parse! %w{fakeparent bar --help} rescue SystemExit end end assert_match(out, /^bar \[options\]*$/) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
commandeer-0.1.1 | test/test_subcommand.rb |