提交 3474764e 编写于 作者: M Mislav Marohnić

Port `hub cherry-pick` tests to cukes

上级 2200d937
Feature: hub cherry-pick
Background:
Given I am in "git://github.com/rtomayko/ronn.git" git repo
And I am "mislav" on github.com with OAuth token "OTOKEN"
Scenario: Unchanged
When I run `hub cherry-pick a319d88`
Then the git command should be unchanged
Scenario: From GitHub commit URL
When I run `hub cherry-pick https://github.com/rtomayko/ronn/commit/a319d88#comments`
Then "git fetch origin" should be run
And "git cherry-pick a319d88" should be run
Scenario: From fork that has existing remote
Given the "mislav" remote has url "git@github.com:mislav/ronn.git"
When I run `hub cherry-pick https://github.com/mislav/ronn/commit/a319d88`
Then "git fetch mislav" should be run
And "git cherry-pick a319d88" should be run
Scenario: Using GitHub owner@SHA notation
Given the "mislav" remote has url "git@github.com:mislav/ronn.git"
When I run `hub cherry-pick mislav@a319d88`
Then "git fetch mislav" should be run
And "git cherry-pick a319d88" should be run
Scenario: Using GitHub owner@SHA notation that is too short
When I run `hub cherry-pick mislav@a319`
Then the git command should be unchanged
Scenario: Unsupported GitHub owner/repo@SHA notation
When I run `hub cherry-pick mislav/ronn@a319d88`
Then the git command should be unchanged
Scenario: Skips processing if `-m/--mainline` is specified
When I run `hub cherry-pick -m 42 mislav@a319d88`
Then the git command should be unchanged
When I run `hub cherry-pick --mainline 42 mislav@a319d88`
Then the git command should be unchanged
Scenario: Using GitHub owner@SHA notation with remote add
When I run `hub cherry-pick mislav@a319d88`
Then "git remote add -f mislav git://github.com/mislav/ronn.git" should be run
And "git cherry-pick a319d88" should be run
Scenario: From fork that doesn't have a remote
When I run `hub cherry-pick https://github.com/jingweno/ronn/commit/a319d88`
Then "git remote add -f jingweno git://github.com/jingweno/ronn.git" should be run
And "git cherry-pick a319d88" should be run
......@@ -116,51 +116,6 @@ class HubTest < Minitest::Test
WebMock.reset!
end
def test_cherry_pick
assert_forwarded "cherry-pick a319d88"
end
def test_cherry_pick_url
url = 'http://github.com/mislav/hub/commit/a319d88'
assert_commands "git fetch mislav", "git cherry-pick a319d88", "cherry-pick #{url}"
end
def test_cherry_pick_url_with_fragment
url = 'http://github.com/mislav/hub/commit/abcdef0123456789#comments'
assert_commands "git fetch mislav", "git cherry-pick abcdef0123456789", "cherry-pick #{url}"
end
def test_cherry_pick_url_with_remote_add
url = 'https://github.com/xoebus/hub/commit/a319d88'
assert_commands "git remote add -f xoebus git://github.com/xoebus/hub.git",
"git cherry-pick a319d88",
"cherry-pick #{url}"
end
def test_cherry_pick_origin_url
url = 'https://github.com/defunkt/hub/commit/a319d88'
assert_commands "git fetch origin", "git cherry-pick a319d88", "cherry-pick #{url}"
end
def test_cherry_pick_github_user_notation
assert_commands "git fetch mislav", "git cherry-pick 368af20", "cherry-pick mislav@368af20"
end
def test_cherry_pick_github_user_repo_notation
# not supported
assert_forwarded "cherry-pick mislav/hubbub@a319d88"
end
def test_cherry_pick_github_notation_too_short
assert_forwarded "cherry-pick mislav@a319"
end
def test_cherry_pick_github_notation_with_remote_add
assert_commands "git remote add -f xoebus git://github.com/xoebus/hub.git",
"git cherry-pick a319d88",
"cherry-pick xoebus@a319d88"
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.
先完成此消息的编辑!
想要评论请 注册