Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
2200d937
H
hub
项目概览
github
/
hub
10 个月 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2200d937
编写于
7月 27, 2014
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Port remaining `pull-request` tests to cukes
上级
29664446
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
35 deletion
+39
-35
features/pull_request.feature
features/pull_request.feature
+33
-1
features/steps.rb
features/steps.rb
+6
-2
test/hub_test.rb
test/hub_test.rb
+0
-32
未找到文件。
features/pull_request.feature
浏览文件 @
2200d937
...
...
@@ -465,7 +465,25 @@ Feature: hub pull-request
And
"git.my.org"
is a whitelisted Enterprise host
Given the GitHub API server
:
"""
post('/api/v3/repos/mislav/coral/pulls') {
post('/api/v3/repos/mislav/coral/pulls', :host_name => 'git.my.org') {
assert :base => 'master',
:head => 'mislav:master'
json :html_url => "the://url"
}
"""
When
I successfully run `hub pull-request -m enterprisey`
Then the output should contain exactly "the
:
//url\n"
Scenario
:
Enterprise remote witch matching branch but no tracking
Given the "origin" remote has url "git@git.my.org
:
mislav/coral.git"
And
I am
"mislav"
on git.my.org with OAuth token
"FITOKEN"
And
"git.my.org"
is a whitelisted Enterprise host
And
I am on the
"feature"
branch pushed to
"origin/feature"
Given the GitHub API server
:
"""
post('/api/v3/repos/mislav/coral/pulls', :host_name => 'git.my.org') {
assert :base => 'master',
:head => 'mislav:feature'
json :html_url => "the://url"
}
"""
...
...
@@ -528,3 +546,17 @@ Feature: hub pull-request
"""
When
I successfully run `hub pull-request -o -m hereyougo`
Then "open the
:
//url"
should
be
run
Scenario
:
Current branch is tracking local branch
Given
git
"push.default"
is set to
"upstream"
And
I am on the
"feature"
branch with upstream
"refs/heads/master"
Given the GitHub API server
:
"""
post('/repos/mislav/coral/pulls') {
assert :base => 'master',
:head => 'mislav:feature'
json :html_url => "the://url"
}
"""
When
I successfully run `hub pull-request -m hereyougo`
Then the output should contain exactly "the
:
//url\n"
features/steps.rb
浏览文件 @
2200d937
...
...
@@ -85,11 +85,15 @@ end
Given
(
/^I am on the "([^"]+)" branch(?: (pushed to|with upstream) "([^"]+)")?$/
)
do
|
name
,
type
,
upstream
|
empty_commit
if
upstream
full_upstream
=
".git/refs/remotes/
#{
upstream
}
"
if
upstream
=~
/^refs\//
full_upstream
=
".git/
#{
upstream
}
"
else
full_upstream
=
".git/refs/remotes/
#{
upstream
}
"
end
in_current_dir
do
FileUtils
.
mkdir_p
File
.
dirname
(
full_upstream
)
FileUtils
.
cp
'.git/refs/heads/master'
,
full_upstream
end
end
unless
upstream
==
'refs/heads/master'
end
track
=
type
==
'pushed to'
?
'--no-track'
:
'--track'
run_silent
%(git checkout --quiet -B #{name} #{track} #{upstream})
...
...
test/hub_test.rb
浏览文件 @
2200d937
...
...
@@ -161,38 +161,6 @@ class HubTest < Minitest::Test
"cherry-pick xoebus@a319d88"
end
def
test_pullrequest_from_branch_tracking_local
stub_config_value
'push.default'
,
'upstream'
stub_branch
(
'refs/heads/feature'
)
stub_tracking
(
'feature'
,
'refs/heads/master'
)
stub_request
(
:post
,
"https://api.github.com/repos/defunkt/hub/pulls"
).
with
(
:body
=>
{
'base'
=>
"master"
,
'head'
=>
"defunkt:feature"
,
'title'
=>
"hereyougo"
}).
to_return
(
:body
=>
mock_pullreq_response
(
1
))
expected
=
"https://github.com/defunkt/hub/pull/1
\n
"
assert_output
expected
,
"pull-request -m hereyougo -f"
end
def
test_pullrequest_enterprise_no_tracking
stub_hub_host
(
'git.my.org'
)
stub_repo_url
(
'git@git.my.org:defunkt/hub.git'
)
stub_branch
(
'refs/heads/feature'
)
stub_remote_branch
(
'origin/feature'
)
stub_tracking_nothing
(
'feature'
)
stub_command_output
"rev-list --cherry-pick --right-only --no-merges origin/feature..."
,
nil
edit_hub_config
do
|
data
|
data
[
'git.my.org'
]
=
[{
'user'
=>
'myfiname'
,
'oauth_token'
=>
'FITOKEN'
}]
end
stub_request
(
:post
,
"https://git.my.org/api/v3/repos/defunkt/hub/pulls"
).
with
(
:body
=>
{
'base'
=>
"master"
,
'head'
=>
"defunkt:feature"
,
'title'
=>
"hereyougo"
}).
to_return
(
:body
=>
mock_pullreq_response
(
1
,
'api/v3/defunkt/hub'
,
'git.my.org'
))
expected
=
"https://git.my.org/api/v3/defunkt/hub/pull/1
\n
"
assert_output
expected
,
"pull-request -m hereyougo -f"
end
def
test_pullrequest_alias
out
=
hub
(
'e-note'
)
assert_equal
hub
(
'pull-request'
),
out
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录