Sha256: bde01dd49acf15730c722ad0c211dfa70a8cee84f7837bd1dfe577beaeb97eae

Contents?: true

Size: 944 Bytes

Versions: 3

Compression:

Stored size: 944 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'minitest/autorun'
require 'webgen/cli'

class TestCLICommandParser < MiniTest::Unit::TestCase

  class SampleCommand < CmdParse::Command
    def initialize
      super('sample', false)
    end
  end

  def setup
    @cli = Webgen::CLI::CommandParser.new
  end

  def test_initialize
    assert_equal(Logger::INFO, @cli.log_level)
    assert_equal(nil, @cli.directory)
  end

  def test_website
    assert_equal(Dir.pwd, @cli.website.directory)
    assert_equal(@cli, @cli.website.ext.cli)
  end

  def test_parse
    @cli.website.ext.cli.add_command(SampleCommand.new)
    out, err = capture_io do
      begin
        @cli.parse(['help'])
        assert_equal(Dir.pwd, @cli.directory + '/')
      rescue SystemExit
      end
    end
    assert_match(/Global options:/, out)
    assert_match(/bundle.*create.*install.*list.*generate.*help.*sample.*.*show.*config.*deps.*extensions.*version/m, out)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webgen-1.0.0.beta3 test/webgen/test_cli.rb
webgen-1.0.0.beta2 test/webgen/test_cli.rb
webgen-1.0.0.beta1 test/webgen/test_cli.rb