2016-01-30 12:32:15 +03:00
|
|
|
Feature: hub release
|
|
|
|
|
|
|
|
Background:
|
|
|
|
Given I am in "git://github.com/mislav/will_paginate.git" git repo
|
|
|
|
And I am "mislav" on github.com with OAuth token "OTOKEN"
|
|
|
|
|
2016-01-30 13:00:00 +03:00
|
|
|
Scenario: List non-draft releases
|
2016-01-30 12:32:15 +03:00
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: true,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.2.0-pre',
|
|
|
|
name: 'will_paginate 1.2.0-pre',
|
|
|
|
draft: false,
|
|
|
|
prerelease: true,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.0.2',
|
|
|
|
name: 'will_paginate 1.0.2',
|
|
|
|
draft: false,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
2016-01-30 12:55:13 +03:00
|
|
|
v1.2.0-pre
|
|
|
|
v1.0.2\n
|
2016-01-30 12:32:15 +03:00
|
|
|
"""
|
2016-01-30 13:00:00 +03:00
|
|
|
|
2016-06-02 20:07:54 +03:00
|
|
|
Scenario: List non-prerelease releases
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: true,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.2.0-pre',
|
|
|
|
name: 'will_paginate 1.2.0-pre',
|
|
|
|
draft: false,
|
|
|
|
prerelease: true,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.0.2',
|
|
|
|
name: 'will_paginate 1.0.2',
|
|
|
|
draft: false,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
2017-04-11 00:07:47 +03:00
|
|
|
When I successfully run `hub release --exclude-prereleases`
|
2016-06-02 20:07:54 +03:00
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
v1.0.2\n
|
|
|
|
"""
|
|
|
|
|
2016-01-30 13:00:00 +03:00
|
|
|
Scenario: List all releases
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: true,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.2.0-pre',
|
|
|
|
name: 'will_paginate 1.2.0-pre',
|
|
|
|
draft: false,
|
|
|
|
prerelease: true,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.0.2',
|
|
|
|
name: 'will_paginate 1.0.2',
|
|
|
|
draft: false,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
2016-01-30 13:43:00 +03:00
|
|
|
When I successfully run `hub release --include-drafts`
|
2016-01-30 13:00:00 +03:00
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
v1.2.0
|
|
|
|
v1.2.0-pre
|
|
|
|
v1.0.2\n
|
|
|
|
"""
|
2016-01-30 13:43:00 +03:00
|
|
|
|
2017-10-02 18:41:58 +03:00
|
|
|
Scenario: Fetch releases across multiple pages
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
assert :per_page => "100", :page => :no
|
|
|
|
response.headers["Link"] = %(<https://api.github.com/repositories/12345?per_page=100&page=2>; rel="next")
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: false,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
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 [
|
|
|
|
{ tag_name: 'v1.2.0-pre',
|
|
|
|
name: 'will_paginate 1.2.0-pre',
|
|
|
|
draft: false,
|
|
|
|
prerelease: true,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.0.2',
|
|
|
|
name: 'will_paginate 1.0.2',
|
|
|
|
draft: false,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
elsif params[:page] == "3"
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.0.0',
|
|
|
|
name: 'will_paginate 1.0.0',
|
|
|
|
draft: false,
|
|
|
|
prerelease: true,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
else
|
|
|
|
status 400
|
|
|
|
end
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
v1.2.0
|
|
|
|
v1.2.0-pre
|
|
|
|
v1.0.2
|
|
|
|
v1.0.0\n
|
|
|
|
"""
|
|
|
|
|
2017-10-03 13:28:17 +03:00
|
|
|
Scenario: List limited number of releases
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
2018-01-30 01:19:02 +03:00
|
|
|
response.headers["Link"] = %(<https://api.github.com/repositories/12345?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 [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: false,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.2.0-pre',
|
|
|
|
name: 'will_paginate 1.2.0-pre',
|
|
|
|
draft: false,
|
|
|
|
prerelease: true,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.0.2',
|
|
|
|
name: 'will_paginate 1.0.2',
|
|
|
|
draft: false,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release -L 2`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
v1.2.0
|
|
|
|
v1.2.0-pre\n
|
|
|
|
"""
|
|
|
|
|
2018-05-30 13:05:45 +03:00
|
|
|
Scenario: Pretty-print releases
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: true,
|
|
|
|
prerelease: false,
|
2018-06-07 16:53:38 +03:00
|
|
|
created_at: '2018-02-27T19:35:32Z',
|
|
|
|
published_at: '2018-04-01T19:35:32Z',
|
|
|
|
assets: [
|
|
|
|
{browser_download_url: 'the://url', label: ''},
|
|
|
|
],
|
2018-05-30 13:05:45 +03:00
|
|
|
},
|
|
|
|
{ tag_name: 'v1.2.0-pre',
|
|
|
|
name: 'will_paginate 1.2.0-pre',
|
|
|
|
draft: false,
|
|
|
|
prerelease: true,
|
|
|
|
},
|
|
|
|
{ tag_name: 'v1.0.2',
|
|
|
|
name: 'will_paginate 1.0.2',
|
|
|
|
draft: false,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release --include-drafts --format='%t (%S)%n'`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
will_paginate 1.2.0 (draft)
|
|
|
|
will_paginate 1.2.0-pre (pre-release)
|
|
|
|
will_paginate 1.0.2 ()\n
|
|
|
|
"""
|
|
|
|
|
2016-02-01 04:13:02 +03:00
|
|
|
Scenario: Repository not found when listing releases
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
status 404
|
|
|
|
json message: "Not Found",
|
|
|
|
documentation_url: "https://developer.github.com/v3"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I run `hub release`
|
|
|
|
Then the stderr should contain exactly:
|
|
|
|
"""
|
|
|
|
Error fetching releases: Not Found (HTTP 404)
|
|
|
|
Not Found\n
|
|
|
|
"""
|
|
|
|
And the exit status should be 1
|
|
|
|
|
|
|
|
Scenario: Server error when listing releases
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
status 504
|
|
|
|
'<html><title>Its fine</title></html>'
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I run `hub release`
|
|
|
|
Then the stderr should contain exactly:
|
|
|
|
"""
|
|
|
|
Error fetching releases: invalid character '<' looking for beginning of value (HTTP 504)\n
|
|
|
|
"""
|
|
|
|
And the exit status should be 1
|
|
|
|
|
2016-01-30 13:43:00 +03:00
|
|
|
Scenario: Show specific release
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: true,
|
|
|
|
prerelease: false,
|
|
|
|
tarball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.tar.gz",
|
|
|
|
zipball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.zip",
|
|
|
|
assets: [
|
|
|
|
{ browser_download_url: "https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
body: <<MARKDOWN
|
|
|
|
### Hello to my release
|
|
|
|
|
|
|
|
Here is what's broken:
|
|
|
|
- everything
|
|
|
|
MARKDOWN
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release show v1.2.0`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
2016-01-31 15:04:57 +03:00
|
|
|
will_paginate 1.2.0
|
2016-01-30 13:43:00 +03:00
|
|
|
|
|
|
|
### Hello to my release
|
|
|
|
|
|
|
|
Here is what's broken:
|
|
|
|
- everything\n
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Show specific release including downloads
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: true,
|
|
|
|
prerelease: false,
|
|
|
|
tarball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.tar.gz",
|
|
|
|
zipball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.zip",
|
|
|
|
assets: [
|
|
|
|
{ browser_download_url: "https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
body: <<MARKDOWN
|
|
|
|
### Hello to my release
|
|
|
|
|
|
|
|
Here is what's broken:
|
|
|
|
- everything
|
|
|
|
MARKDOWN
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release show v1.2.0 --show-downloads`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
2016-01-31 15:04:57 +03:00
|
|
|
will_paginate 1.2.0
|
2016-01-30 13:43:00 +03:00
|
|
|
|
|
|
|
### Hello to my release
|
|
|
|
|
|
|
|
Here is what's broken:
|
|
|
|
- everything
|
|
|
|
|
|
|
|
## Downloads
|
|
|
|
|
|
|
|
https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip
|
|
|
|
https://github.com/mislav/will_paginate/archive/v1.2.0.zip
|
|
|
|
https://github.com/mislav/will_paginate/archive/v1.2.0.tar.gz\n
|
|
|
|
"""
|
2016-01-31 14:45:01 +03:00
|
|
|
|
2018-10-31 00:46:11 +03:00
|
|
|
Scenario: Format specific release
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: true,
|
|
|
|
prerelease: false,
|
|
|
|
tarball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.tar.gz",
|
|
|
|
zipball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.zip",
|
|
|
|
assets: [
|
|
|
|
{ browser_download_url: "https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
body: <<MARKDOWN
|
|
|
|
### Hello to my release
|
|
|
|
|
|
|
|
Here is what's broken:
|
|
|
|
- everything
|
|
|
|
MARKDOWN
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release show v1.2.0 --format='%t (%T)%n%as%n%n%b%n'`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
will_paginate 1.2.0 (v1.2.0)
|
|
|
|
https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip
|
|
|
|
|
|
|
|
### Hello to my release
|
|
|
|
|
|
|
|
Here is what's broken:
|
2019-08-21 20:53:45 +03:00
|
|
|
- everything\n
|
2018-10-31 00:46:11 +03:00
|
|
|
"""
|
|
|
|
|
2018-06-07 16:53:13 +03:00
|
|
|
Scenario: Show release no tag
|
|
|
|
When I run `hub release show`
|
|
|
|
Then the exit status should be 1
|
|
|
|
Then the stderr should contain "hub release show"
|
|
|
|
|
2016-01-31 14:45:01 +03:00
|
|
|
Scenario: Create a release
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/mislav/will_paginate/releases') {
|
|
|
|
assert :draft => true,
|
|
|
|
:tag_name => "v1.2.0",
|
2016-08-21 19:10:31 +03:00
|
|
|
:target_commitish => "",
|
2016-01-31 14:45:01 +03:00
|
|
|
:name => "will_paginate 1.2.0: Instant Gratification Monkey",
|
|
|
|
:body => ""
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release create -dm "will_paginate 1.2.0: Instant Gratification Monkey" v1.2.0`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/mislav/will_paginate/releases/v1.2.0\n
|
|
|
|
"""
|
|
|
|
|
2019-09-29 11:58:21 +03:00
|
|
|
Scenario: Create a release from file
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/mislav/will_paginate/releases') {
|
|
|
|
assert :name => "Epic New Version",
|
|
|
|
:body => "body\ngoes\n\nhere"
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
And a file named "message.txt" with:
|
|
|
|
"""
|
|
|
|
Epic New Version
|
|
|
|
|
|
|
|
body
|
|
|
|
goes
|
|
|
|
|
|
|
|
here
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release create -F message.txt v1.2.0`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/mislav/will_paginate/releases/v1.2.0\n
|
|
|
|
"""
|
|
|
|
|
2016-08-21 19:10:31 +03:00
|
|
|
Scenario: Create a release with target commitish
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/mislav/will_paginate/releases') {
|
|
|
|
assert :tag_name => "v1.2.0",
|
|
|
|
:target_commitish => "my-branch"
|
|
|
|
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0"
|
|
|
|
}
|
|
|
|
"""
|
2016-09-11 04:12:01 +03:00
|
|
|
When I successfully run `hub release create -m hello v1.2.0 -t my-branch`
|
2016-08-21 19:10:31 +03:00
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/mislav/will_paginate/releases/v1.2.0\n
|
|
|
|
"""
|
|
|
|
|
2016-01-31 14:45:01 +03:00
|
|
|
Scenario: Create a release with assets
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/mislav/will_paginate/releases') {
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0",
|
2019-01-26 20:43:28 +03:00
|
|
|
:upload_url => "https://uploads.github.com/uploads/assets{?name,label}"
|
2016-01-31 14:45:01 +03:00
|
|
|
}
|
2019-01-26 20:43:28 +03:00
|
|
|
post('/uploads/assets', :host_name => 'uploads.github.com') {
|
|
|
|
halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
|
2016-01-31 14:45:01 +03:00
|
|
|
assert :name => 'hello-1.2.0.tar.gz',
|
|
|
|
:label => 'Hello World'
|
|
|
|
status 201
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
And a file named "hello-1.2.0.tar.gz" with:
|
|
|
|
"""
|
|
|
|
TARBALL
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release create -m "hello" v1.2.0 -a "./hello-1.2.0.tar.gz#Hello World"`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
https://github.com/mislav/will_paginate/releases/v1.2.0
|
|
|
|
Attaching release asset `./hello-1.2.0.tar.gz'...\n
|
|
|
|
"""
|
|
|
|
|
2016-09-11 19:21:23 +03:00
|
|
|
Scenario: Open new release in web browser
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
post('/repos/mislav/will_paginate/releases') {
|
|
|
|
status 201
|
|
|
|
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release create -o -m hello v1.2.0`
|
|
|
|
Then the output should contain exactly ""
|
|
|
|
And "open https://github.com/mislav/will_paginate/releases/v1.2.0" should be run
|
|
|
|
|
2018-06-07 16:53:13 +03:00
|
|
|
Scenario: Create release no tag
|
|
|
|
When I run `hub release create -m hello`
|
|
|
|
Then the exit status should be 1
|
|
|
|
Then the stderr should contain "hub release create"
|
|
|
|
|
2016-01-31 14:45:01 +03:00
|
|
|
Scenario: Edit existing release
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
|
|
|
|
tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: true,
|
|
|
|
prerelease: false,
|
|
|
|
body: <<MARKDOWN
|
|
|
|
### Hello to my release
|
|
|
|
|
|
|
|
Here is what's broken:
|
|
|
|
- everything
|
|
|
|
MARKDOWN
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
patch('/repos/mislav/will_paginate/releases/123') {
|
|
|
|
assert :name => 'KITTENS EVERYWHERE',
|
|
|
|
:draft => false,
|
|
|
|
:prerelease => nil
|
|
|
|
json({})
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
Given the git commit editor is "vim"
|
|
|
|
And the text editor adds:
|
|
|
|
"""
|
|
|
|
KITTENS EVERYWHERE
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release edit --draft=false v1.2.0`
|
2019-08-21 19:23:50 +03:00
|
|
|
Then the output should not contain anything
|
2016-02-01 04:59:09 +03:00
|
|
|
|
2018-09-27 12:51:54 +03:00
|
|
|
Scenario: Edit existing release when there is a fork
|
|
|
|
Given the "doge" remote has url "git://github.com/doge/will_paginate.git"
|
|
|
|
And I am on the "feature" branch with upstream "doge/feature"
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
|
|
|
|
tag_name: 'v1.2.0',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
patch('/repos/mislav/will_paginate/releases/123') {
|
|
|
|
json({})
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release edit -m "" v1.2.0`
|
2019-08-21 19:23:50 +03:00
|
|
|
Then the output should not contain anything
|
2018-09-27 12:51:54 +03:00
|
|
|
|
2018-06-07 16:53:38 +03:00
|
|
|
Scenario: Edit existing release no title
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
And a file named "message.txt" with:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
When I run `hub release edit v1.2.0 -F message.txt`
|
|
|
|
Then the exit status should be 1
|
|
|
|
And the stderr should contain exactly:
|
|
|
|
"""
|
|
|
|
Aborting editing due to empty release title\n
|
|
|
|
"""
|
|
|
|
|
2016-02-01 04:59:09 +03:00
|
|
|
Scenario: Edit existing release by uploading assets
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
deleted = false
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
|
2019-01-26 20:43:28 +03:00
|
|
|
upload_url: 'https://uploads.github.com/uploads/assets{?name,label}',
|
2016-02-01 04:59:09 +03:00
|
|
|
tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: true,
|
|
|
|
prerelease: false,
|
|
|
|
assets: [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/456',
|
|
|
|
name: 'hello-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
delete('/repos/mislav/will_paginate/assets/456') {
|
|
|
|
deleted = true
|
|
|
|
status 204
|
|
|
|
}
|
2019-01-26 20:43:28 +03:00
|
|
|
post('/uploads/assets', :host_name => 'uploads.github.com') {
|
2016-02-01 04:59:09 +03:00
|
|
|
halt 422 unless deleted
|
2019-01-26 20:43:28 +03:00
|
|
|
halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
|
2016-02-01 04:59:09 +03:00
|
|
|
assert :name => 'hello-1.2.0.tar.gz',
|
|
|
|
:label => nil
|
|
|
|
status 201
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
And a file named "hello-1.2.0.tar.gz" with:
|
|
|
|
"""
|
|
|
|
TARBALL
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release edit -m "" v1.2.0 -a hello-1.2.0.tar.gz`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
Attaching release asset `hello-1.2.0.tar.gz'...\n
|
|
|
|
"""
|
2016-02-06 02:24:01 +03:00
|
|
|
|
2018-06-07 16:53:13 +03:00
|
|
|
Scenario: Edit release no tag
|
|
|
|
When I run `hub release edit -m hello`
|
|
|
|
Then the exit status should be 1
|
|
|
|
Then the stderr should contain "hub release edit"
|
|
|
|
|
2019-10-30 14:07:40 +03:00
|
|
|
Scenario: Download a release asset
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
assets: [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
|
|
|
|
name: 'hello-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
get('/repos/mislav/will_paginate/assets/9876') {
|
|
|
|
halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
|
|
|
|
halt 415 unless request.accept?('application/octet-stream')
|
|
|
|
status 302
|
|
|
|
headers['Location'] = 'https://github-cloud.s3.amazonaws.com/releases/12204602/22ea221a-cf2f-11e2-222a-b3a3c3b3aa3a.gz'
|
|
|
|
""
|
|
|
|
}
|
|
|
|
get('/releases/12204602/22ea221a-cf2f-11e2-222a-b3a3c3b3aa3a.gz', :host_name => 'github-cloud.s3.amazonaws.com') {
|
|
|
|
halt 400 unless request.env['HTTP_AUTHORIZATION'].nil?
|
|
|
|
halt 415 unless request.accept?('application/octet-stream')
|
|
|
|
headers['Content-Type'] = 'application/octet-stream'
|
|
|
|
"ASSET_TARBALL"
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release download v1.2.0`
|
|
|
|
Then the output should contain exactly:
|
2016-02-06 02:24:01 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
Downloading hello-1.2.0.tar.gz ...\n
|
2016-02-06 02:24:01 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
And the file "hello-1.2.0.tar.gz" should contain exactly:
|
2019-10-25 02:43:23 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
ASSET_TARBALL
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Download release assets that match pattern
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
assets: [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
|
|
|
|
name: 'hello-amd32-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9877',
|
|
|
|
name: 'hello-amd64-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9878',
|
|
|
|
name: 'hello-x86-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
get('/repos/mislav/will_paginate/assets/9876') { "TARBALL" }
|
|
|
|
get('/repos/mislav/will_paginate/assets/9877') { "TARBALL" }
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release download v1.2.0 --include '*amd*'`
|
|
|
|
Then the output should contain exactly:
|
2019-10-25 02:43:23 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
Downloading hello-amd32-1.2.0.tar.gz ...
|
|
|
|
Downloading hello-amd64-1.2.0.tar.gz ...\n
|
2019-10-26 02:21:17 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
And the file "hello-x86-1.2.0.tar.gz" should not exist
|
|
|
|
|
|
|
|
Scenario: Glob pattern allows exact match
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
assets: [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
|
|
|
|
name: 'hello-amd32-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9877',
|
|
|
|
name: 'hello-amd64-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9878',
|
|
|
|
name: 'hello-x86-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
get('/repos/mislav/will_paginate/assets/9876') { "ASSET_TARBALL" }
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release download v1.2.0 --include hello-amd32-1.2.0.tar.gz`
|
|
|
|
Then the output should contain exactly:
|
2019-10-26 02:21:17 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
Downloading hello-amd32-1.2.0.tar.gz ...\n
|
2019-10-26 02:21:17 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
And the file "hello-amd32-1.2.0.tar.gz" should contain exactly:
|
2019-10-26 02:21:17 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
ASSET_TARBALL
|
2019-10-30 03:37:12 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
And the file "hello-amd64-1.2.0.tar.gz" should not exist
|
|
|
|
And the file "hello-x86-1.2.0.tar.gz" should not exist
|
|
|
|
|
|
|
|
Scenario: Advanced glob pattern
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
assets: [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
|
|
|
|
name: 'hello-amd32-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
|
|
|
|
name: 'hello-amd32-1.2.1.tar.gz',
|
|
|
|
},
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
|
|
|
|
name: 'hello-amd32-1.2.2.tar.gz',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
get('/repos/mislav/will_paginate/assets/9876') { "ASSET_TARBALL" }
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release download v1.2.0 --include '*-amd32-?.?.[01].tar.gz'`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
Downloading hello-amd32-1.2.0.tar.gz ...
|
|
|
|
Downloading hello-amd32-1.2.1.tar.gz ...\n
|
2019-10-30 03:37:12 +03:00
|
|
|
"""
|
2019-10-30 14:07:40 +03:00
|
|
|
|
|
|
|
Scenario: No matches for download pattern
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
assets: [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
|
|
|
|
name: 'hello-amd32-1.2.0.tar.gz',
|
|
|
|
},
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
|
|
|
|
name: 'hello-amd32-1.2.1.tar.gz',
|
|
|
|
},
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
|
|
|
|
name: 'hello-amd32-1.2.2.tar.gz',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I run `hub release download v1.2.0 --include amd32`
|
|
|
|
Then the exit status should be 1
|
|
|
|
Then the stderr should contain exactly:
|
|
|
|
"""
|
|
|
|
the `--include` pattern did not match any available assets:
|
|
|
|
hello-amd32-1.2.0.tar.gz
|
|
|
|
hello-amd32-1.2.1.tar.gz
|
|
|
|
hello-amd32-1.2.2.tar.gz\n
|
|
|
|
"""
|
|
|
|
|
2018-06-07 16:53:13 +03:00
|
|
|
Scenario: Download release no tag
|
|
|
|
When I run `hub release download`
|
|
|
|
Then the exit status should be 1
|
|
|
|
Then the stderr should contain "hub release download"
|
|
|
|
|
2016-10-31 20:09:57 +03:00
|
|
|
Scenario: Delete a release
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
json [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
|
|
|
|
tag_name: 'v1.2.0',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
delete('/repos/mislav/will_paginate/releases/123') {
|
|
|
|
status 204
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release delete v1.2.0`
|
2019-08-21 19:23:50 +03:00
|
|
|
Then the output should not contain anything
|
2016-10-31 20:09:57 +03:00
|
|
|
|
2018-05-29 11:54:44 +03:00
|
|
|
Scenario: Release not found
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/will_paginate/releases') {
|
|
|
|
assert :per_page => "100"
|
|
|
|
json [
|
|
|
|
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
|
|
|
|
tag_name: 'v1.2.0',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
delete('/repos/mislav/will_paginate/releases/123') {
|
|
|
|
status 204
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I run `hub release delete v2.0`
|
|
|
|
Then the exit status should be 1
|
|
|
|
And the stderr should contain exactly:
|
|
|
|
"""
|
|
|
|
Unable to find release with tag name `v2.0'\n
|
|
|
|
"""
|
|
|
|
|
2016-05-03 17:59:19 +03:00
|
|
|
Scenario: Enterprise list releases
|
|
|
|
Given the "origin" remote has url "git@git.my.org:mislav/will_paginate.git"
|
|
|
|
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/will_paginate/releases', :host_name => 'git.my.org') {
|
|
|
|
json [
|
|
|
|
{ tag_name: 'v1.2.0',
|
|
|
|
name: 'will_paginate 1.2.0',
|
|
|
|
draft: false,
|
|
|
|
prerelease: false,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
When I successfully run `hub release`
|
|
|
|
Then the output should contain exactly:
|
|
|
|
"""
|
|
|
|
v1.2.0\n
|
|
|
|
"""
|