Sha256: a5a0929621c7f502e82200b7d8fca267fb10b1046b24a014627f8eeae9e96f09

Contents?: true

Size: 884 Bytes

Versions: 2

Compression:

Stored size: 884 Bytes

Contents

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

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

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

  def test_namespaced_has_parser
    assert(@commands['namespaced'][:parser], "parse")
  end

  def test_has_klass
    assert(@commands['namespaced'][:klass], "Name::Spaced")
  end

  def test_output_noopts
    out, err = capture_io do
      begin
        Commandeer.parse! ''
      rescue SystemExit
      end
    end
    assert_match(out, /^.*Usage.*\n\n\t.*namespaced.*$/)
  end

  def test_output_namespaced
    out, err = capture_io do
      begin
        Commandeer.parse! %w{namespaced an_opt}
      rescue SystemExit
      end
    end
    assert_match(out, /an_opt/)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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