Sha256: 455cab9b9aa697142b22361294434de234b6437f8c0483189ba8674cc6ce739c

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

require "#{File.expand_path(File.join(File.dirname(__FILE__), "helper.rb"))}"

class TestCommand < MiniTest::Unit::TestCase
  def setup
    require 'helpers/command.rb'
    @commands = Commandeer.commands
  end

  def test_has_command
    assert_includes(@commands.keys, "foo")
  end

  def test_has_parser
    assert(@commands['foo'][:parser], "parse")
  end

  def test_has_klass
    assert(@commands['foo'][:klass], "PrimaryCommand")
  end

  def test_output_noopts
    out, err = capture_io do
      begin
        Commandeer.parse! ''
      rescue SystemExit
      end
    end

    assert_match(out, /^.*\tfoo.*$/)
  end

  def test_output_foo
    out, err = capture_io do
      begin
        Commandeer.parse! %w{foo --help}
      rescue SystemExit
      end
    end

    assert_match(out, /^foo \[options\]*$/)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
commandeer-0.1.1 test/test_command.rb
commandeer-0.1.0 test/test_command.rb