Sha256: acfa1a67b4f9f4c6665594e8e64723f1827923a1c9d5942215bb499e7d70a065

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

require 'test/unit'
require '../lib/sunzi'

class TestCli < Test::Unit::TestCase
  def setup
    @cli = Sunzi::Cli.new
  end

  def test_parse_target
    assert_equal ['user', 'example.com', '2222'], @cli.parse_target('user@example.com:2222')
    assert_equal ['root', 'example.com', '2222'], @cli.parse_target('example.com:2222')
    assert_equal ['user', 'example.com', '22'],   @cli.parse_target('user@example.com')
    assert_equal ['root', 'example.com', '22'],   @cli.parse_target('example.com')
    assert_equal ['root', '192.168.0.1', '22'],   @cli.parse_target('192.168.0.1')
  end

  def test_create
    @cli.create 'sandbox'
    assert File.exist?('sandbox/sunzi.yml')
    FileUtils.rm_rf 'sandbox'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sunzi-0.4.1 test/test_cli.rb