From 928b40dee50306fa2cc799bc0eacc7e45ceb855e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 14 Jun 2019 15:33:50 +0200 Subject: [PATCH] [pr show] reformat tests --- features/pr-show.feature | 145 ++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 71 deletions(-) diff --git a/features/pr-show.feature b/features/pr-show.feature index f50e91a2..7cc368f2 100644 --- a/features/pr-show.feature +++ b/features/pr-show.feature @@ -1,79 +1,82 @@ Feature: hub pr show - Background: - Given I am in "git://github.com/ashemesh/hub.git" git repo - And I am "ashemesh" on github.com with OAuth token "OTOKEN" + Background: + Given I am in "git://github.com/ashemesh/hub.git" git repo + And I am "ashemesh" on github.com with OAuth token "OTOKEN" - Scenario: Open Current Branch Pull Request - Given I am on the "topic" branch - Given the GitHub API server: - """ - get('/repos/ashemesh/hub/pulls'){ - assert :state => "open", - :head => "ashemesh:topic" - json [ - { - :html_url => "https://github.com/ashemesh/hub/pull/1", - }, - ] - } - """ - When I successfully run `hub pr show` - Then "open https://github.com/ashemesh/hub/pull/1" should be run + Scenario: Current branch + Given I am on the "topic" branch + Given the GitHub API server: + """ + get('/repos/ashemesh/hub/pulls'){ + assert :state => "open", + :head => "ashemesh:topic" + json [ + { :html_url => "https://github.com/ashemesh/hub/pull/102" }, + ] + } + """ + When I successfully run `hub pr show` + Then "open https://github.com/ashemesh/hub/pull/102" should be run + + Scenario: Current branch output URL + Given I am on the "topic" branch + Given the GitHub API server: + """ + get('/repos/ashemesh/hub/pulls'){ + assert :state => "open", + :head => "ashemesh:topic" + json [ + { :html_url => "https://github.com/ashemesh/hub/pull/102" }, + ] + } + """ + When I successfully run `hub pr show -u` + Then "open https://github.com/ashemesh/hub/pull/102" should not be run + And the output should contain exactly: + """ + https://github.com/ashemesh/hub/pull/102\n + """ - Scenario: Open Current Branch Pull Request In Upstream - Given the "upstream" remote has url "git@github.com:github/hub.git" + Scenario: Current branch in fork + Given the "upstream" remote has url "git@github.com:github/hub.git" And I am on the "topic" branch Given the GitHub API server: - """ - get('/repos/github/hub/pulls'){ - assert :state => "open", - :head => "ashemesh:topic" - json [ - { - :html_url => "https://github.com/github/hub/pull/1", - }, - ] - } - """ + """ + get('/repos/github/hub/pulls'){ + assert :state => "open", + :head => "ashemesh:topic" + json [ + { :html_url => "https://github.com/github/hub/pull/102" }, + ] + } + """ When I successfully run `hub pr show` - Then "open https://github.com/github/hub/pull/1" should be run + Then "open https://github.com/github/hub/pull/102" should be run - Scenario: Open Pull Request For Given Head - Given the GitHub API server: - """ - get('/repos/ashemesh/hub/pulls'){ - assert :state => "open", - :head => "ashemesh:topic" - json [ - { - :html_url => "https://github.com/ashemesh/hub/pull/1", - }, - ] - } - """ - When I successfully run `hub pr show --head topic` - Then "open https://github.com/ashemesh/hub/pull/1" should be run + Scenario: Explicit head branch + Given the GitHub API server: + """ + get('/repos/ashemesh/hub/pulls'){ + assert :state => "open", + :head => "ashemesh:topic" + json [ + { :html_url => "https://github.com/ashemesh/hub/pull/102" }, + ] + } + """ + When I successfully run `hub pr show --head topic` + Then "open https://github.com/ashemesh/hub/pull/102" should be run - Scenario: Open Pull Request In Fork Repository Given Head - Given the GitHub API server: - """ - get('/repos/ashemesh/hub'){ - json :html_url => "https://github.com/ashemesh/hub", - :parent => { - :html_url => "https://github.com/github/hub", - :name => "hub", - :owner => { :login => "github" } - } - } - get('/repos/github/hub/pulls'){ - assert :state => "open", - :head => "ashemesh:topic" - json [ - { - :html_url => "https://github.com/github/hub/pull/1", - }, - ] - } - """ - When I successfully run `hub pr show --head ashemesh:topic` - Then "open https://github.com/github/hub/pull/1" should be run + Scenario: Explicit head branch with owner + Given the GitHub API server: + """ + get('/repos/ashemesh/hub/pulls'){ + assert :state => "open", + :head => "github:topic" + json [ + { :html_url => "https://github.com/ashemesh/hub/pull/102" }, + ] + } + """ + When I successfully run `hub pr show --head github:topic` + Then "open https://github.com/ashemesh/hub/pull/102" should be run -- GitLab