`pull-request --no-edit`: test case for no commits detected

This commit is contained in:
Mislav Marohnić 2018-06-06 15:53:43 +02:00
Родитель 2628ba3471
Коммит a9bb733386
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -246,7 +246,7 @@ of text is the title and the rest is the description.`, fullBase, fullHead))
} else if flagPullRequestNoEdit {
commits, _ := git.RefList(baseTracking, head)
if len(commits) == 0 {
utils.Check(fmt.Errorf("No commits detected between '<BASE>' and '<HEAD>' branches"))
utils.Check(fmt.Errorf("Aborted: no commits detected between %s and %s", baseTracking, head))
}
message, err := git.Show(commits[len(commits)-1])
utils.Check(err)

Просмотреть файл

@ -231,6 +231,16 @@ Feature: hub pull-request
When I successfully run `hub pull-request --push --no-edit`
Then the output should contain exactly "the://url\n"
Scenario: No commits with "--no-edit"
Given I am on the "master" branch pushed to "origin/master"
When I successfully run `git checkout --quiet -b topic`
And I run `hub pull-request --no-edit`
Then the exit status should be 1
And the stderr should contain exactly:
"""
Aborted: no commits detected between origin/master and topic\n
"""
Scenario: Message template should include git log summary between base and head
Given the text editor adds:
"""