forked from mislav/hub
/
checkout.feature
80 lines (74 loc) · 2.9 KB
/
checkout.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Feature: hub checkout <PULLREQ-URL>
Background:
Given I am in "git://github.com/mojombo/jekyll.git" git repo
And I am "mislav" on github.com with OAuth token "OTOKEN"
Scenario: Unchanged command
When I run `hub checkout master`
Then "git checkout master" should be run
Scenario: Checkout a pull request
Given the GitHub API server:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => false }
}
}
"""
When I run `hub checkout -f https://github.com/mojombo/jekyll/pull/77 -q`
Then "git remote add -f -t fixes mislav git://github.com/mislav/jekyll.git" should be run
And "git checkout -f --track -B mislav-fixes mislav/fixes -q" should be run
Scenario: Custom name for new branch
Given the GitHub API server:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => false }
}
}
"""
When I run `hub checkout https://github.com/mojombo/jekyll/pull/77 fixes-from-mislav`
Then "git remote add -f -t fixes mislav git://github.com/mislav/jekyll.git" should be run
And "git checkout --track -B fixes-from-mislav mislav/fixes" should be run
Scenario: Private pull request
Given the GitHub API server:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => true }
}
}
"""
When I run `hub checkout -f https://github.com/mojombo/jekyll/pull/77 -q`
Then "git remote add -f -t fixes mislav git@github.com:mislav/jekyll.git" should be run
And "git checkout -f --track -B mislav-fixes mislav/fixes -q" should be run
Scenario: Custom name for new branch
Given the GitHub API server:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => false }
}
}
"""
When I run `hub checkout https://github.com/mojombo/jekyll/pull/77 fixes-from-mislav`
Then "git remote add -f -t fixes mislav git://github.com/mislav/jekyll.git" should be run
And "git checkout --track -B fixes-from-mislav mislav/fixes" should be run
Scenario: Remote for user already exists
Given the GitHub API server:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => false }
}
}
"""
And the "mislav" remote has url "git://github.com/mislav/jekyll.git"
When I run `hub checkout https://github.com/mojombo/jekyll/pull/77`
Then "git remote set-branches --add mislav fixes" should be run
And "git fetch mislav +refs/heads/fixes:refs/remotes/mislav/fixes" should be run
And "git checkout --track -B mislav-fixes mislav/fixes" should be run