-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
issue-transfer.feature
73 lines (71 loc) · 2.04 KB
/
issue-transfer.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
Feature: hub issue transfer
Background:
Given I am in "git://github.com/octocat/hello-world.git" git repo
And I am "srafi1" on github.com with OAuth token "OTOKEN"
Scenario: Transfer issue
Given the GitHub API server:
"""
count = 0
post('/graphql') {
halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
count += 1
case count
when 1
assert :query => /\A\s*query\(/,
:variables => {
:issue => 123,
:sourceOwner => "octocat",
:sourceRepo => "hello-world",
:targetOwner => "octocat",
:targetRepo => "spoon-knife",
}
json :data => {
:source => { :issue => { :id => "ISSUE-ID" } },
:target => { :id => "REPO-ID" },
}
when 2
assert :query => /\A\s*mutation\(/,
:variables => {
:issue => "ISSUE-ID",
:repo => "REPO-ID",
}
json :data => {
:transferIssue => { :issue => { :url => "the://url" } }
}
else
status 400
json :message => "request not stubbed"
end
}
"""
When I successfully run `hub issue transfer 123 spoon-knife`
Then the output should contain exactly "the://url\n"
Scenario: Transfer to another owner
Given the GitHub API server:
"""
count = 0
post('/graphql') {
count += 1
case count
when 1
assert :variables => {
:targetOwner => "monalisa",
:targetRepo => "playground",
}
json :data => {}
when 2
json :errors => [
{ :message => "New repository must have the same owner as the current repository" },
]
else
status 400
json :message => "request not stubbed"
end
}
"""
When I run `hub issue transfer 123 monalisa/playground`
Then the exit status should be 1
Then the stderr should contain exactly:
"""
API error: New repository must have the same owner as the current repository\n
"""