Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
ea217d49
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 搜索 >>
提交
ea217d49
编写于
5月 11, 2013
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
port `checkout` tests to cukes
上级
3a852e9f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
80 addition
and
43 deletion
+80
-43
features/checkout.feature
features/checkout.feature
+80
-0
test/hub_test.rb
test/hub_test.rb
+0
-43
未找到文件。
features/checkout.feature
0 → 100644
浏览文件 @
ea217d49
Feature
:
hub checkout <PULLREQ-URL>
Background
:
Given I am in "git
:
//github.com/mojombo/jekyll.git"
git
repo
And
I am
"mislav"
on github.com with OAuth token
"OTOKEN"
Scenario
:
Unchanged command
When
I run `hub checkout master`
Then
"git checkout master"
should be run
Scenario
:
Checkout a pull request
Given the GitHub API server
:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => false }
}
}
"""
When I run `hub checkout -f https
:
//github.com/mojombo/jekyll/pull/7
7
-q`
Then "git remote add -f -t fixes mislav git
:
//github.com/mislav/jekyll.git"
should
be
run
And
"git checkout -f --track -B mislav-fixes mislav/fixes -q"
should be run
Scenario
:
Custom name for new branch
Given the GitHub API server
:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => false }
}
}
"""
When I run `hub checkout https
:
//github.com/mojombo/jekyll/pull/7
7
fixes-from-mislav`
Then "git remote add -f -t fixes mislav git
:
//github.com/mislav/jekyll.git"
should
be
run
And
"git checkout --track -B fixes-from-mislav mislav/fixes"
should be run
Scenario
:
Private pull request
Given the GitHub API server
:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => true }
}
}
"""
When I run `hub checkout -f https
:
//github.com/mojombo/jekyll/pull/7
7
-q`
Then "git remote add -f -t fixes mislav git@github.com
:
mislav/jekyll.git"
should
be
run
And
"git checkout -f --track -B mislav-fixes mislav/fixes -q"
should be run
Scenario
:
Custom name for new branch
Given the GitHub API server
:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => false }
}
}
"""
When I run `hub checkout https
:
//github.com/mojombo/jekyll/pull/7
7
fixes-from-mislav`
Then "git remote add -f -t fixes mislav git
:
//github.com/mislav/jekyll.git"
should
be
run
And
"git checkout --track -B fixes-from-mislav mislav/fixes"
should be run
Scenario
:
Remote for user already exists
Given the GitHub API server
:
"""
get('/repos/mojombo/jekyll/pulls/77') {
json :head => {
:label => 'mislav:fixes',
:repo => { :private => false }
}
}
"""
And the "mislav" remote has url "git
:
//github.com/mislav/jekyll.git"
When I run `hub checkout https
:
//github.com/mojombo/jekyll/pull/77`
Then
"git remote set-branches --add mislav fixes"
should be run
And "git fetch mislav +refs/heads/fixes
:
refs/remotes/mislav/fixes"
should
be
run
And
"git checkout --track -B mislav-fixes mislav/fixes"
should be run
test/hub_test.rb
浏览文件 @
ea217d49
...
...
@@ -444,49 +444,6 @@ class HubTest < Test::Unit::TestCase
assert_output
expected
,
"pull-request hereyougo -b feature -f"
end
def
test_checkout_no_changes
assert_forwarded
"checkout master"
end
def
test_checkout_pullrequest
stub_request
(
:get
,
"https://api.github.com/repos/defunkt/hub/pulls/73"
).
to_return
(
:body
=>
mock_pull_response
(
'blueyed:feature'
))
assert_commands
'git remote add -f -t feature blueyed git://github.com/blueyed/hub.git'
,
'git checkout -f --track -B blueyed-feature blueyed/feature -q'
,
"checkout -f https://github.com/defunkt/hub/pull/73/files -q"
end
def
test_checkout_private_pullrequest
stub_request
(
:get
,
"https://api.github.com/repos/defunkt/hub/pulls/73"
).
to_return
(
:body
=>
mock_pull_response
(
'blueyed:feature'
,
:private
))
assert_commands
'git remote add -f -t feature blueyed git@github.com:blueyed/hub.git'
,
'git checkout --track -B blueyed-feature blueyed/feature'
,
"checkout https://github.com/defunkt/hub/pull/73/files"
end
def
test_checkout_pullrequest_custom_branch
stub_request
(
:get
,
"https://api.github.com/repos/defunkt/hub/pulls/73"
).
to_return
(
:body
=>
mock_pull_response
(
'blueyed:feature'
))
assert_commands
'git remote add -f -t feature blueyed git://github.com/blueyed/hub.git'
,
'git checkout --track -B review blueyed/feature'
,
"checkout https://github.com/defunkt/hub/pull/73/files review"
end
def
test_checkout_pullrequest_existing_remote
stub_command_output
'remote'
,
"origin
\n
blueyed"
stub_request
(
:get
,
"https://api.github.com/repos/defunkt/hub/pulls/73"
).
to_return
(
:body
=>
mock_pull_response
(
'blueyed:feature'
))
assert_commands
'git remote set-branches --add blueyed feature'
,
'git fetch blueyed +refs/heads/feature:refs/remotes/blueyed/feature'
,
'git checkout --track -B blueyed-feature blueyed/feature'
,
"checkout https://github.com/defunkt/hub/pull/73/files"
end
def
test_version
out
=
hub
(
'--version'
)
assert_includes
"git version 1.7.0.4"
,
out
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录