-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
am.feature
86 lines (79 loc) · 3.42 KB
/
am.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
83
84
85
86
Feature: hub am
Background:
Given I am in "git://github.com/mislav/dotfiles.git" git repo
And I am "mislav" on github.com with OAuth token "OTOKEN"
Scenario: Apply a local patch
When I run `hub am some.patch`
Then the git command should be unchanged
Scenario: Apply commits from pull request
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles/pulls/387') {
halt 400 unless request.env['HTTP_ACCEPT'] == 'application/vnd.github.v3.patch;charset=utf-8'
generate_patch "Create a README"
}
"""
When I successfully run `hub am -q -3 https://github.com/mislav/dotfiles/pull/387`
Then the output should not contain anything
Then the latest commit message should be "Create a README"
Scenario: Apply commits when TMPDIR is empty
Given $TMPDIR is ""
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles/pulls/387') {
halt 400 unless request.env['HTTP_ACCEPT'] == 'application/vnd.github.v3.patch;charset=utf-8'
generate_patch "Create a README"
}
"""
When I successfully run `hub am -q https://github.com/mislav/dotfiles/pull/387`
Then the latest commit message should be "Create a README"
Scenario: Enterprise repo
Given I am in "git://git.my.org/mislav/dotfiles.git" git repo
And I am "mislav" on git.my.org with OAuth token "FITOKEN"
And "git.my.org" is a whitelisted Enterprise host
Given the GitHub API server:
"""
get('/api/v3/repos/mislav/dotfiles/pulls/387') {
halt 400 unless request.env['HTTP_ACCEPT'] == 'application/vnd.github.v3.patch;charset=utf-8'
generate_patch "Create a README"
}
"""
When I successfully run `hub am -q -3 https://git.my.org/mislav/dotfiles/pull/387`
Then the latest commit message should be "Create a README"
Scenario: Apply patch from commit
Given the GitHub API server:
"""
get('/repos/davidbalbert/dotfiles/commits/fdb9921') {
halt 400 unless request.env['HTTP_ACCEPT'] == 'application/vnd.github.v3.patch;charset=utf-8'
generate_patch "Create a README"
}
"""
When I successfully run `hub am -q https://github.com/davidbalbert/dotfiles/commit/fdb9921`
Then the latest commit message should be "Create a README"
Scenario: Apply patch from commit in a pull request
Given the GitHub API server:
"""
get('/repos/davidbalbert/dotfiles/commits/fdb9921') {
halt 400 unless request.env['HTTP_ACCEPT'] == 'application/vnd.github.v3.patch;charset=utf-8'
generate_patch "Create a README"
}
"""
When I successfully run `hub am -q https://github.com/davidbalbert/dotfiles/pull/123/commits/fdb9921`
Then the latest commit message should be "Create a README"
Scenario: Apply patch from gist
Given the GitHub API server:
"""
get('/gists/8da7fb575debd88c54cf', :host_name => 'api.github.com') {
json :files => {
'file.diff' => {
:raw_url => "https://gist.github.com/raw/8da7fb575debd88c54cf/SHA/file.diff"
}
}
}
get('/raw/8da7fb575debd88c54cf/SHA/file.diff', :host_name => 'gist.github.com') {
halt 400 unless request.env['HTTP_ACCEPT'] == 'text/plain;charset=utf-8'
generate_patch "Create a README"
}
"""
When I successfully run `hub am -q https://gist.github.com/8da7fb575debd88c54cf`
Then the latest commit message should be "Create a README"