hub_test.rb 1.2 KB
Newer Older
1 2
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'helper'
C
Chris Wanstrath 已提交
3 4 5

class HubTest < Test::Unit::TestCase
  def test_private_clone
C
Chris Wanstrath 已提交
6 7 8
    input   = "clone -p rtomayko/ron"
    command = "git clone git@github.com:rtomayko/ron.git"
    assert_command input, command
C
Chris Wanstrath 已提交
9 10 11
  end

  def test_public_clone
C
Chris Wanstrath 已提交
12 13 14
    input   = "clone rtomayko/ron"
    command = "git clone git://github.com/rtomayko/ron.git"
    assert_command input, command
C
Chris Wanstrath 已提交
15 16 17
  end

  def test_private_remote
18
    input   = "remote add -p rtomayko"
C
Chris Wanstrath 已提交
19 20
    command = "git remote add rtomayko git@github.com:rtomayko/hub.git"
    assert_command input, command
C
Chris Wanstrath 已提交
21 22 23
  end

  def test_public_remote
24
    input   = "remote add rtomayko"
C
Chris Wanstrath 已提交
25 26
    command = "git remote add rtomayko git://github.com/rtomayko/hub.git"
    assert_command input, command
C
Chris Wanstrath 已提交
27 28 29
  end

  def test_init
C
Chris Wanstrath 已提交
30 31 32 33 34 35
    h = Hub("init -g")
    assert_equal "git init", h.command
    assert_equal "git remote add origin git@github.com:defunkt/hub.git", h.after
  end

  def test_version
C
terse  
Chris Wanstrath 已提交
36
    assert_equal "git version 1.6.4.2\nhub version 0.1.0\n", hub('--version')
C
Chris Wanstrath 已提交
37
  end
C
Chris Wanstrath 已提交
38 39 40 41 42 43 44 45

  def test_help
    assert_equal Hub::Commands.improved_help_text, hub("help")
  end

  def test_help_by_default
    assert_equal Hub::Commands.improved_help_text, hub("")
  end
C
Chris Wanstrath 已提交
46
end