-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
pr-checkout.feature
82 lines (79 loc) · 2.78 KB
/
pr-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
81
82
Feature: hub pr checkout <PULLREQ-NUMBER>
Background:
Given I am in "git://github.com/mojombo/jekyll.git" git repo
And I am "mojombo" on github.com with OAuth token "OTOKEN"
Scenario: Checkout a pull request
Given the GitHub API server:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :number => 77, :head => {
:ref => "fixes",
:repo => {
:owner => { :login => "mislav" },
:name => "jekyll",
:private => false
}
}, :base => {
:repo => {
:name => 'jekyll',
:html_url => 'https://github.com/mojombo/jekyll',
:owner => { :login => "mojombo" },
}
},
:maintainer_can_modify => false,
:html_url => 'https://github.com/mojombo/jekyll/pull/77'
}
"""
When I successfully run `hub pr checkout 77`
Then "git fetch origin refs/pull/77/head:fixes" should be run
And "git checkout fixes" should be run
And "fixes" should merge "refs/pull/77/head" from remote "origin"
Scenario: Custom name for new branch
Given the GitHub API server:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :number => 77, :head => {
:ref => "fixes",
:repo => {
:name => "jekyll",
:owner => { :login => "mislav" },
}
}, :base => {
:repo => {
:name => 'jekyll',
:html_url => 'https://github.com/mojombo/jekyll',
:owner => { :login => "mojombo" },
}
},
:maintainer_can_modify => false,
:html_url => 'https://github.com/mojombo/jekyll/pull/77'
}
"""
When I successfully run `hub pr checkout 77 fixes-from-mislav`
Then "git fetch origin refs/pull/77/head:fixes-from-mislav" should be run
And "git checkout fixes-from-mislav" should be run
And "fixes-from-mislav" should merge "refs/pull/77/head" from remote "origin"
Scenario: Same-repo
Given the GitHub API server:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :number => 77, :head => {
:ref => "fixes",
:repo => {
:name => "jekyll",
:owner => { :login => "mojombo" },
}
}, :base => {
:repo => {
:name => "jekyll",
:html_url => "https://github.com/mojombo/jekyll",
:owner => { :login => "mojombo" },
}
},
:html_url => 'https://github.com/mojombo/jekyll/pull/77'
}
"""
When I successfully run `hub pr checkout 77`
Then "git fetch origin +refs/heads/fixes:refs/remotes/origin/fixes" should be run
And "git checkout -b fixes --no-track origin/fixes" should be run
And "fixes" should merge "refs/heads/fixes" from remote "origin"