Sha256: eb8c751fc82d6d6f5f357df14296fca57898ab0c20821c06a5d4cff1c89ff2fb

Contents?: true

Size: 850 Bytes

Versions: 8

Compression:

Stored size: 850 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper'

class CliUsageTest < Test::Unit::TestCase
  run_command_line_as {CliApp.run}
  
  run_with_options ["--help"] do
    assert_successful_run
    assert_out_contains /Usage:/
  end

  run_with_options [], "running with no arguments" do
    assert_successful_run
  end

  run_with_options ["--option", "PRINT_THIS"] do
    assert_successful_run
    assert_out_contains /PRINT_THIS/
  end
  
  run_with_options [], "run_with_options could be used within block" do
    assert_successful_run
    run_with_options []
  end
  
  run_with_options ["--invalid-option"], "running with invalid option" do
    assert_failed_run
  end
end

class CliTestNoCommandLineDefined < Test::Unit::TestCase
  def test_failure_when_command_line_defined
    assert_raise(RuntimeError) {self.class.run_with_options []}
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
afurmanov-clicase-0.1.10 test/test.rb
afurmanov-clicase-0.1.11 test/test.rb
afurmanov-clicase-0.1.5 test/test.rb
afurmanov-clicase-0.1.6 test/test.rb
afurmanov-clicase-0.1.7 test/test.rb
afurmanov-clicase-0.1.8 test/test.rb
afurmanov-clicase-0.1.9 test/test.rb
fkocherga-cmd_line_test-0.1.2 test/test.rb