Sha256: ef9f4b2405c34e2e10fe4fd45d681603aedf8eb35eb9661c4305ce8f7ee51c6e

Contents?: true

Size: 920 Bytes

Versions: 5

Compression:

Stored size: 920 Bytes

Contents

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

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

class TestCLICommandParser < Minitest::Test

  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(/create.*generate.*help.*install.*sample.*.*show.*config.*deps.*extensions.*version/m, out)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
webgen-1.3.0 test/webgen/test_cli.rb
webgen-1.2.1 test/webgen/test_cli.rb
webgen-1.2.0 test/webgen/test_cli.rb
webgen-1.1.0 test/webgen/test_cli.rb
webgen-1.0.0 test/webgen/test_cli.rb