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-02-03 15:01:13 +03:00
|
|
|
assert :assignee => "Cornwe19"
|
|
|
|
|
|
|
|
json [
|
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-02-01 20:18:48 +03:00
|
|
|
When I 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
|
|
|
And the exit status should be 0
|
|
|
|
|
|
|
|
Scenario: Fetch issues for a given milestone
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :milestone => "none"
|
|
|
|
|
|
|
|
json [
|
|
|
|
{ :number => 102,
|
|
|
|
:title => "First issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
{ :number => 13,
|
|
|
|
:title => "Second issue",
|
|
|
|
:state => "open",
|
|
|
|
:user => { :login => "octocat" },
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I run `hub issue -M none`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
#102 First issue
|
|
|
|
#13 Second issue\n
|
|
|
|
"""
|
2016-05-12 16:58:51 +03:00
|
|
|
And the exit status should be 0
|
|
|
|
|
2016-08-16 18:27:44 +03:00
|
|
|
Scenario: Fetch issues across multiple pages
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/github/hub/issues') {
|
|
|
|
assert :per_page => "100", :page => nil
|
|
|
|
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
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I run `hub issue`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
#102 First issue
|
|
|
|
#13 Second issue
|
|
|
|
#103 Issue from 2nd page
|
|
|
|
#21 Even more issuez\n
|
|
|
|
"""
|
|
|
|
And the exit status should be 0
|
|
|
|
|
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
|
|
|
|
|
|
|
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 => "",
|
|
|
|
:labels => nil
|
|
|
|
|
|
|
|
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-08-15 14:52:23 +03:00
|
|
|
:milestone => nil,
|
|
|
|
:assignees => nil,
|
|
|
|
: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"],
|
|
|
|
:labels => nil
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/github/hub/issues/1337"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub issue create -m "hello" -M 12 -a 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
|
|
|
|
"""
|