2016-02-01 04:46:12 +03:00
|
|
|
Feature: hub issue
|
|
|
|
Background:
|
|
|
|
Given I am in "git://github.com/github/hub.git" git repo
|
|
|
|
And I am "cornwe19" on github.com with OAuth token "OTOKEN"
|
|
|
|
|
|
|
|
Scenario: Fetch issues
|
2016-02-01 20:25:10 +03:00
|
|
|
Given the GitHub API server:
|
2016-02-01 04:46:12 +03:00
|
|
|
"""
|
2016-02-01 20:25:10 +03:00
|
|
|
get('/repos/github/hub/issues') {
|
2016-09-14 00:41:49 +03:00
|
|
|
assert :assignee => "Cornwe19",
|
|
|
|
:sort => nil,
|
2018-10-26 15:06:15 +03:00
|
|
|
:direction => "desc"
|
2016-02-03 15:01:13 +03:00
|
|
|
|
|
|
|
json [
|
2017-02-15 16:38:27 +03:00
|
|
|
{ :number => 999,
|
|
|
|
:title => "First pull",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
:pull_request => { },
|
|
|
|
},
|
2016-02-01 20:25:10 +03:00
|
|
|
{ :number => 102,
|
|
|
|
:title => "First issue",
|
2016-02-03 15:01:13 +03:00
|
|
|
:state => "open",
|
2016-08-15 17:52:44 +03:00
|
|
|
:user => { :login => "octocat" },
|
2016-02-01 20:25:10 +03:00
|
|
|
},
|
2016-02-03 15:01:13 +03:00
|
|
|
{ :number => 13,
|
2016-02-01 20:25:10 +03:00
|
|
|
:title => "Second issue",
|
2016-02-03 15:01:13 +03:00
|
|
|
:state => "open",
|
2016-08-15 17:52:44 +03:00
|
|
|
:user => { :login => "octocat" },
|
2016-02-03 15:01:13 +03:00
|
|
|
},
|
|
|
|
]
|
2016-02-01 20:25:10 +03:00
|
|
|
}
|
2016-02-01 04:46:12 +03:00
|
|
|
"""
|
2016-08-21 14:23:26 +03:00
|
|
|
When I successfully run `hub issue -a Cornwe19`
|
2016-02-01 04:46:12 +03:00
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
2016-05-12 16:58:51 +03:00
|
|
|
#102 First issue
|
|
|
|
#13 Second issue\n
|
|
|
|
"""
|
2016-08-18 08:54:30 +03:00
|
|
|
|
2017-10-03 13:28:17 +03:00
|
|
|
Scenario: List limited number of issues
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
2018-01-30 01:19:02 +03:00
|
|
|
response.headers["Link"] = %(<https://api.github.com/repositories/12345/issues?per_page=100&page=2>; rel="next")
|
2018-01-30 01:41:23 +03:00
|
|
|
assert :per_page => "3"
|
2017-10-03 13:28:17 +03:00
|
|
|
json [
|
|
|
|
{ :number => 102,
|
|
|
|
:title => "First issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
{ :number => 13,
|
|
|
|
:title => "Second issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
{ :number => 999,
|
|
|
|
:title => "Third issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue -L 2`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
#102 First issue
|
|
|
|
#13 Second issue\n
|
|
|
|
"""
|
|
|
|
|
2017-02-15 16:38:27 +03:00
|
|
|
Scenario: Fetch issues and pull requests
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :assignee => "Cornwe19",
|
|
|
|
:sort => nil,
|
2018-10-26 15:06:15 +03:00
|
|
|
:direction => "desc"
|
2017-02-15 16:38:27 +03:00
|
|
|
|
|
|
|
json [
|
|
|
|
{ :number => 999,
|
|
|
|
:title => "First pull",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
:pull_request => { },
|
|
|
|
},
|
|
|
|
{ :number => 102,
|
|
|
|
:title => "First issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
{ :number => 13,
|
|
|
|
:title => "Second issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue -a Cornwe19 --include-pulls`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
#999 First pull
|
|
|
|
#102 First issue
|
|
|
|
#13 Second issue\n
|
|
|
|
"""
|
|
|
|
|
2016-08-18 09:15:44 +03:00
|
|
|
Scenario: Fetch issues not assigned to any milestone
|
2016-08-18 08:54:30 +03:00
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :milestone => "none"
|
2016-08-19 22:04:40 +03:00
|
|
|
json []
|
2016-08-18 09:15:44 +03:00
|
|
|
}
|
|
|
|
"""
|
2016-08-21 14:23:26 +03:00
|
|
|
When I successfully run `hub issue -M none`
|
2016-08-18 09:15:44 +03:00
|
|
|
|
2019-06-14 03:44:25 +03:00
|
|
|
Scenario: Fetch issues assigned to milestone by number
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :milestone => "12"
|
|
|
|
json []
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue -M 12`
|
|
|
|
|
|
|
|
Scenario: Fetch issues assigned to milestone by name
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/milestones') {
|
|
|
|
status 200
|
|
|
|
json [
|
|
|
|
{ :number => 237, :title => "prerelease" },
|
|
|
|
{ :number => 1337, :title => "v1" },
|
|
|
|
{ :number => 41319, :title => "Hello World!" }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :milestone => "1337"
|
|
|
|
json []
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue -M v1`
|
|
|
|
|
2016-08-18 09:15:44 +03:00
|
|
|
Scenario: Fetch issues created by a given user
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :creator => "octocat"
|
2016-08-19 22:04:40 +03:00
|
|
|
json []
|
2016-08-18 08:54:30 +03:00
|
|
|
}
|
|
|
|
"""
|
2016-08-21 14:23:26 +03:00
|
|
|
When I successfully run `hub issue -c octocat`
|
2016-08-18 09:55:56 +03:00
|
|
|
|
|
|
|
Scenario: Fetch issues mentioning a given user
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :mentioned => "octocat"
|
2016-08-19 22:04:40 +03:00
|
|
|
json []
|
2016-08-18 09:55:56 +03:00
|
|
|
}
|
|
|
|
"""
|
2016-08-21 14:23:26 +03:00
|
|
|
When I successfully run `hub issue -@ octocat`
|
2016-08-18 10:07:24 +03:00
|
|
|
|
|
|
|
Scenario: Fetch issues with certain labels
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :labels => "foo,bar"
|
2016-08-19 22:04:40 +03:00
|
|
|
json []
|
2016-08-18 10:07:24 +03:00
|
|
|
}
|
|
|
|
"""
|
2016-08-21 14:23:26 +03:00
|
|
|
When I successfully run `hub issue -l foo,bar`
|
2016-08-18 10:25:35 +03:00
|
|
|
|
2016-08-19 22:04:40 +03:00
|
|
|
Scenario: Fetch issues updated after a certain date and time
|
2016-08-18 10:25:35 +03:00
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :since => "2016-08-18T09:11:32Z"
|
2016-08-19 22:04:40 +03:00
|
|
|
json []
|
2016-08-18 10:25:35 +03:00
|
|
|
}
|
|
|
|
"""
|
2016-08-21 14:23:26 +03:00
|
|
|
When I successfully run `hub issue -d 2016-08-18T09:11:32Z`
|
2016-05-12 16:58:51 +03:00
|
|
|
|
2016-09-14 00:41:49 +03:00
|
|
|
Scenario: Fetch issues sorted by number of comments ascending
|
2016-08-27 23:09:50 +03:00
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :sort => "comments"
|
|
|
|
assert :direction => "asc"
|
|
|
|
|
2016-09-14 00:41:49 +03:00
|
|
|
json []
|
2016-08-27 23:09:50 +03:00
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue -o comments -^`
|
|
|
|
|
2016-08-16 18:27:44 +03:00
|
|
|
Scenario: Fetch issues across multiple pages
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
2016-09-09 00:27:32 +03:00
|
|
|
assert :per_page => "100", :page => :no
|
2016-08-16 18:27:44 +03:00
|
|
|
response.headers["Link"] = %(<https://api.github.com/repositories/12345?per_page=100&page=2>; rel="next")
|
|
|
|
json [
|
|
|
|
{ :number => 102,
|
|
|
|
:title => "First issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
get('/repositories/12345') {
|
|
|
|
assert :per_page => "100"
|
|
|
|
if params[:page] == "2"
|
|
|
|
response.headers["Link"] = %(<https://api.github.com/repositories/12345?per_page=100&page=3>; rel="next")
|
|
|
|
json [
|
|
|
|
{ :number => 13,
|
|
|
|
:title => "Second issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
{ :number => 103,
|
|
|
|
:title => "Issue from 2nd page",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
]
|
|
|
|
elsif params[:page] == "3"
|
|
|
|
json [
|
|
|
|
{ :number => 21,
|
|
|
|
:title => "Even more issuez",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
]
|
|
|
|
else
|
|
|
|
status 400
|
|
|
|
end
|
|
|
|
}
|
|
|
|
"""
|
2016-08-21 14:23:26 +03:00
|
|
|
When I successfully run `hub issue`
|
2016-08-16 18:27:44 +03:00
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
#102 First issue
|
|
|
|
#13 Second issue
|
|
|
|
#103 Issue from 2nd page
|
|
|
|
#21 Even more issuez\n
|
|
|
|
"""
|
|
|
|
|
2016-05-12 16:58:51 +03:00
|
|
|
Scenario: Custom format for issues list
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
2016-08-19 16:32:58 +03:00
|
|
|
assert :assignee => 'Cornwe19'
|
2016-05-12 16:58:51 +03:00
|
|
|
json [
|
|
|
|
{ :number => 102,
|
|
|
|
:title => "First issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "lascap" },
|
|
|
|
},
|
|
|
|
{ :number => 13,
|
|
|
|
:title => "Second issue",
|
|
|
|
:state => "closed",
|
|
|
|
:user => { :login => "mislav" },
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
2016-08-19 16:32:58 +03:00
|
|
|
When I successfully run `hub issue -f "%I,%au%n" -a Cornwe19`
|
2016-05-12 16:58:51 +03:00
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
102,lascap
|
|
|
|
13,mislav\n
|
2016-02-01 04:46:12 +03:00
|
|
|
"""
|
2016-08-19 16:32:58 +03:00
|
|
|
|
2019-03-29 02:28:44 +03:00
|
|
|
Scenario: Custom format with no-color labels
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
json [
|
|
|
|
{ :number => 102,
|
|
|
|
:title => "First issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "morganwahl" },
|
|
|
|
:labels => [
|
|
|
|
{ :name => 'Has Migration',
|
|
|
|
:color => 'cfcfcf' },
|
|
|
|
{ :name => 'Maintenance Window',
|
|
|
|
:color => '888888' },
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{ :number => 201,
|
|
|
|
:title => "No labels",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
:labels => []
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue -f "%I: %L%n" --color=never`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
102: Has Migration, Maintenance Window
|
|
|
|
201: \n
|
|
|
|
"""
|
|
|
|
|
2016-08-19 16:32:58 +03:00
|
|
|
Scenario: List all assignees
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
json [
|
|
|
|
{ :number => 102,
|
|
|
|
:title => "First issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
:assignees => [
|
|
|
|
{ :login => "mislav" },
|
|
|
|
{ :login => "lascap" },
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{ :number => 13,
|
|
|
|
:title => "Second issue",
|
|
|
|
:state => "closed",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
:assignees => [
|
|
|
|
{ :login => "keenahn" },
|
|
|
|
]
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue -f "%I:%as%n"`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
102:mislav, lascap
|
|
|
|
13:keenahn\n
|
|
|
|
"""
|
2016-02-03 15:01:13 +03:00
|
|
|
|
|
|
|
Scenario: Create an issue
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :title => "Not workie, pls fix",
|
|
|
|
:body => "",
|
2016-09-09 00:27:32 +03:00
|
|
|
:labels => :no
|
2016-02-03 15:01:13 +03:00
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue create -m "Not workie, pls fix"`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
|
|
|
|
2016-08-15 16:34:03 +03:00
|
|
|
Scenario: Create an issue and open in browser
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
status 201
|
|
|
|
json :html_url => "the://url"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue create -o -m hello`
|
|
|
|
Then the output should contain exactly ""
|
|
|
|
Then "open the://url" should be run
|
|
|
|
|
2016-02-03 15:01:13 +03:00
|
|
|
Scenario: Create an issue with labels
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :title => "hello",
|
|
|
|
:body => "",
|
2016-09-09 00:27:32 +03:00
|
|
|
:milestone => :no,
|
|
|
|
:assignees => :no,
|
2016-08-15 14:52:23 +03:00
|
|
|
:labels => ["wont fix", "docs", "nope"]
|
2016-02-03 15:01:13 +03:00
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
2016-08-15 14:52:23 +03:00
|
|
|
When I successfully run `hub issue create -m "hello" -l "wont fix,docs" -lnope`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Create an issue with milestone and assignees
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :title => "hello",
|
|
|
|
:body => "",
|
|
|
|
:milestone => 12,
|
|
|
|
:assignees => ["mislav", "josh", "pcorpet"],
|
2016-09-09 00:27:32 +03:00
|
|
|
:labels => :no
|
2016-08-15 14:52:23 +03:00
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
2019-01-18 07:13:19 +03:00
|
|
|
When I successfully run `hub issue create -m "hello" -M 12 --assign mislav,josh -apcorpet`
|
2016-02-03 15:01:13 +03:00
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
2019-06-14 03:44:25 +03:00
|
|
|
|
|
|
|
Scenario: Create an issue with milestone by name
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/milestones') {
|
|
|
|
status 200
|
|
|
|
json [
|
|
|
|
{ :number => 237, :title => "prerelease" },
|
|
|
|
{ :number => 1337, :title => "v1" },
|
|
|
|
{ :number => 41319, :title => "Hello World!" }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :milestone => 41319
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue create -m "hello" -M "hello world!"`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
2016-11-21 14:42:46 +03:00
|
|
|
|
2018-01-23 19:30:46 +03:00
|
|
|
Scenario: Editing empty issue message
|
|
|
|
Given the git commit editor is "vim"
|
|
|
|
And the text editor adds:
|
|
|
|
"""
|
|
|
|
hello
|
|
|
|
|
|
|
|
my nice issue
|
|
|
|
"""
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :title => "hello",
|
|
|
|
:body => "my nice issue"
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue create -m '' --edit`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
|
|
|
|
2016-11-21 14:42:46 +03:00
|
|
|
Scenario: Issue template
|
|
|
|
Given the git commit editor is "vim"
|
|
|
|
And the text editor adds:
|
|
|
|
"""
|
|
|
|
hello
|
|
|
|
"""
|
|
|
|
And a file named "issue_template.md" with:
|
|
|
|
"""
|
|
|
|
my nice issue template
|
|
|
|
"""
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :title => "hello",
|
|
|
|
:body => "my nice issue template"
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue create`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Issue template from a subdirectory
|
|
|
|
Given the git commit editor is "vim"
|
|
|
|
And the text editor adds:
|
|
|
|
"""
|
|
|
|
hello
|
|
|
|
"""
|
|
|
|
And a file named ".github/issue_template.md" with:
|
|
|
|
"""
|
|
|
|
my nice issue template
|
|
|
|
"""
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :title => "hello",
|
|
|
|
:body => "my nice issue template"
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
Given a directory named "subdir"
|
|
|
|
When I cd to "subdir"
|
|
|
|
And I successfully run `hub issue create`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
|
|
|
|
2018-08-23 16:38:34 +03:00
|
|
|
Scenario: Multiple issue templates
|
|
|
|
Given the git commit editor is "vim"
|
|
|
|
And the text editor adds:
|
|
|
|
"""
|
|
|
|
hello
|
|
|
|
"""
|
|
|
|
And a file named ".github/ISSUE_TEMPLATE/bug_report.md" with:
|
|
|
|
"""
|
|
|
|
I want to report a bug
|
|
|
|
"""
|
|
|
|
And a file named ".github/ISSUE_TEMPLATE/feature_request.md" with:
|
|
|
|
"""
|
|
|
|
There is a feature that I need!
|
|
|
|
"""
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :title => "hello",
|
|
|
|
:body => ""
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue create`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Multiple issue templates with default
|
|
|
|
Given the git commit editor is "vim"
|
|
|
|
And the text editor adds:
|
|
|
|
"""
|
|
|
|
hello
|
|
|
|
"""
|
|
|
|
And a directory named ".github/ISSUE_TEMPLATE"
|
|
|
|
And a file named ".github/ISSUE_TEMPLATE.md" with:
|
|
|
|
"""
|
|
|
|
The default template
|
|
|
|
"""
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :title => "hello",
|
|
|
|
:body => "The default template"
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue create`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
|
|
|
|
2016-11-21 14:42:46 +03:00
|
|
|
Scenario: A file named ".github"
|
|
|
|
Given the git commit editor is "vim"
|
|
|
|
And the text editor adds:
|
|
|
|
"""
|
|
|
|
hello
|
|
|
|
"""
|
|
|
|
And a file named ".github" with:
|
|
|
|
"""
|
|
|
|
this is ignored
|
|
|
|
"""
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/github/hub/issues') {
|
|
|
|
assert :title => "hello",
|
|
|
|
:body => ""
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue create`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/github/hub/issues/1337\n
|
|
|
|
"""
|
2018-01-30 13:33:25 +03:00
|
|
|
|
|
|
|
Scenario: Fetch issue labels
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/labels') {
|
2019-01-03 06:43:25 +03:00
|
|
|
response.headers["Link"] = %(<https://api.github.com/repositories/12345/labels?per_page=100&page=2>; rel="next")
|
|
|
|
assert :per_page => "100", :page => nil
|
2018-01-30 13:33:25 +03:00
|
|
|
json [
|
2019-01-03 06:43:25 +03:00
|
|
|
{ :name => "Discuss",
|
|
|
|
:color => "0000ff",
|
|
|
|
},
|
2018-01-30 13:33:25 +03:00
|
|
|
{ :name => "bug",
|
|
|
|
:color => "ff0000",
|
|
|
|
},
|
|
|
|
{ :name => "feature",
|
|
|
|
:color => "00ff00",
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
2019-01-03 06:43:25 +03:00
|
|
|
get('/repositories/12345/labels') {
|
|
|
|
assert :per_page => "100", :page => "2"
|
|
|
|
json [
|
|
|
|
{ :name => "affects",
|
|
|
|
:color => "ffffff",
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
2018-01-30 13:33:25 +03:00
|
|
|
"""
|
|
|
|
When I successfully run `hub issue labels`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
2019-01-03 06:43:25 +03:00
|
|
|
affects
|
2018-01-30 19:40:32 +03:00
|
|
|
bug
|
2019-01-03 06:43:25 +03:00
|
|
|
Discuss
|
2018-01-30 19:40:32 +03:00
|
|
|
feature\n
|
2018-01-30 13:33:25 +03:00
|
|
|
"""
|
2018-10-29 12:02:32 +03:00
|
|
|
|
|
|
|
Scenario: Fetch single issue
|
|
|
|
Given the GitHub API server:
|
2018-10-31 00:35:46 +03:00
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues/102') {
|
|
|
|
json \
|
|
|
|
:number => 102,
|
|
|
|
:state => "open",
|
|
|
|
:body => "I want this feature",
|
|
|
|
:title => "Feature request for hub issue show",
|
|
|
|
:created_at => "2017-04-14T16:00:49Z",
|
|
|
|
:user => { :login => "royels" },
|
|
|
|
:assignees => [{:login => "royels"}],
|
|
|
|
:comments => 1
|
|
|
|
}
|
2018-10-29 12:02:32 +03:00
|
|
|
get('/repos/github/hub/issues/102/comments') {
|
2018-10-31 00:35:46 +03:00
|
|
|
json [
|
|
|
|
{ :body => "I am from the future",
|
|
|
|
:created_at => "2011-04-14T16:00:49Z",
|
|
|
|
:user => { :login => "octocat" }
|
|
|
|
},
|
|
|
|
{ :body => "I did the thing",
|
|
|
|
:created_at => "2013-10-30T22:20:00Z",
|
|
|
|
:user => { :login => "hubot" }
|
|
|
|
},
|
|
|
|
]
|
2018-10-29 12:02:32 +03:00
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue show 102`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
# Feature request for hub issue show
|
|
|
|
|
|
|
|
* created by @royels on 2017-04-14 16:00:49 +0000 UTC
|
|
|
|
* assignees: royels
|
|
|
|
|
|
|
|
I want this feature
|
|
|
|
|
|
|
|
## Comments:
|
|
|
|
|
|
|
|
### comment by @octocat on 2011-04-14 16:00:49 +0000 UTC
|
|
|
|
|
|
|
|
I am from the future
|
|
|
|
|
2018-10-31 00:35:46 +03:00
|
|
|
### comment by @hubot on 2013-10-30 22:20:00 +0000 UTC
|
|
|
|
|
|
|
|
I did the thing\n
|
2018-10-29 12:02:32 +03:00
|
|
|
"""
|
|
|
|
|
2018-10-31 00:46:11 +03:00
|
|
|
Scenario: Format single issue
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues/102') {
|
|
|
|
json \
|
|
|
|
:number => 102,
|
|
|
|
:state => "open",
|
|
|
|
:body => "I want this feature",
|
|
|
|
:title => "Feature request for hub issue show",
|
|
|
|
:created_at => "2017-04-14T16:00:49Z",
|
|
|
|
:user => { :login => "royels" },
|
|
|
|
:assignees => [{:login => "royels"}],
|
|
|
|
:comments => 1
|
|
|
|
}
|
|
|
|
get('/repos/github/hub/issues/102/comments') {
|
|
|
|
json [
|
|
|
|
{ :body => "I am from the future",
|
|
|
|
:created_at => "2011-04-14T16:00:49Z",
|
|
|
|
:user => { :login => "octocat" }
|
|
|
|
},
|
|
|
|
{ :body => "I did the thing",
|
|
|
|
:created_at => "2013-10-30T22:20:00Z",
|
|
|
|
:user => { :login => "hubot" }
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue show 102 --format='%I %t%n%n%b%n'`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
102 Feature request for hub issue show
|
|
|
|
|
|
|
|
I want this feature\n
|
|
|
|
"""
|
|
|
|
|
2018-12-20 19:55:46 +03:00
|
|
|
Scenario: Format with literal % characters
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues/102') {
|
|
|
|
json \
|
|
|
|
:number => 102,
|
|
|
|
:state => "open",
|
|
|
|
:title => "Feature request % hub",
|
|
|
|
:user => { :login => "alexfornuto" }
|
|
|
|
}
|
|
|
|
get('/repos/github/hub/issues/102/comments') {
|
|
|
|
json []
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue show 102 --format='%t%%t%%n%n'`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
Feature request % hub%t%n\n
|
|
|
|
"""
|
|
|
|
|
2018-10-29 12:02:32 +03:00
|
|
|
Scenario: Did not supply an issue number
|
|
|
|
When I run `hub issue show`
|
|
|
|
Then the exit status should be 1
|
2019-01-18 05:45:51 +03:00
|
|
|
Then the stderr should contain "Usage: hub issue"
|
2018-10-29 12:02:32 +03:00
|
|
|
|
|
|
|
Scenario: Show error message if http code is not 200 for issues endpoint
|
|
|
|
Given the GitHub API server:
|
2018-10-31 00:35:46 +03:00
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues/102') {
|
|
|
|
status 500
|
|
|
|
}
|
2018-10-29 12:02:32 +03:00
|
|
|
"""
|
|
|
|
When I run `hub issue show 102`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
Error fetching issue: Internal Server Error (HTTP 500)\n
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Show error message if http code is not 200 for comments endpoint
|
|
|
|
Given the GitHub API server:
|
2018-10-31 00:35:46 +03:00
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues/102') {
|
|
|
|
json \
|
|
|
|
:number => 102,
|
|
|
|
:body => "I want this feature",
|
|
|
|
:title => "Feature request for hub issue show",
|
|
|
|
:created_at => "2017-04-14T16:00:49Z",
|
|
|
|
:user => { :login => "royels" }
|
|
|
|
}
|
2018-10-29 12:02:32 +03:00
|
|
|
get('/repos/github/hub/issues/102/comments') {
|
2018-10-31 00:35:46 +03:00
|
|
|
status 404
|
2018-10-29 12:02:32 +03:00
|
|
|
}
|
2018-10-31 00:35:46 +03:00
|
|
|
"""
|
2018-10-29 12:02:32 +03:00
|
|
|
When I run `hub issue show 102`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
Error fetching comments for issue: Not Found (HTTP 404)\n
|
2018-10-31 00:35:46 +03:00
|
|
|
"""
|