2013-01-20 22:43:28 +04:00
|
|
|
Feature: hub ci-status
|
|
|
|
|
|
|
|
Background:
|
2013-05-14 12:00:16 +04:00
|
|
|
Given I am in "git://github.com/michiels/pencilbox.git" git repo
|
2013-01-20 22:43:28 +04:00
|
|
|
And I am "michiels" on github.com with OAuth token "OTOKEN"
|
|
|
|
|
|
|
|
Scenario: Fetch commit SHA
|
2013-01-30 01:08:26 +04:00
|
|
|
Given there is a commit named "the_sha"
|
|
|
|
Given the remote commit state of "michiels/pencilbox" "the_sha" is "success"
|
2013-01-20 22:43:28 +04:00
|
|
|
When I run `hub ci-status the_sha`
|
|
|
|
Then the output should contain exactly "success\n"
|
|
|
|
And the exit status should be 0
|
|
|
|
|
2013-10-29 03:56:00 +04:00
|
|
|
Scenario: Fetch commit SHA with URL
|
|
|
|
Given there is a commit named "the_sha"
|
|
|
|
Given the remote commit state of "michiels/pencilbox" "the_sha" is "success"
|
|
|
|
When I run `hub ci-status the_sha -v`
|
|
|
|
Then the output should contain "success: https://travis-ci.org/michiels/pencilbox/builds/1234567"
|
|
|
|
And the exit status should be 0
|
|
|
|
|
2013-04-26 19:53:31 +04:00
|
|
|
Scenario: Multiple statuses, latest is passing
|
|
|
|
Given there is a commit named "the_sha"
|
|
|
|
Given the remote commit states of "michiels/pencilbox" "the_sha" are:
|
|
|
|
"""
|
2013-05-12 00:20:45 +04:00
|
|
|
[ { :state => 'success' },
|
|
|
|
{ :state => 'pending' } ]
|
2013-04-26 19:53:31 +04:00
|
|
|
"""
|
|
|
|
When I run `hub ci-status the_sha`
|
|
|
|
Then the output should contain exactly "success\n"
|
|
|
|
And the exit status should be 0
|
|
|
|
|
2013-01-20 22:43:28 +04:00
|
|
|
Scenario: Exit status 1 for 'error' and 'failure'
|
2013-01-30 01:08:26 +04:00
|
|
|
Given the remote commit state of "michiels/pencilbox" "HEAD" is "error"
|
2013-01-20 22:43:28 +04:00
|
|
|
When I run `hub ci-status`
|
|
|
|
Then the exit status should be 1
|
2013-01-30 01:08:26 +04:00
|
|
|
And the output should contain exactly "error\n"
|
2013-01-20 22:43:28 +04:00
|
|
|
|
|
|
|
Scenario: Use HEAD when no sha given
|
2013-01-30 01:08:26 +04:00
|
|
|
Given the remote commit state of "michiels/pencilbox" "HEAD" is "pending"
|
2013-01-20 22:43:28 +04:00
|
|
|
When I run `hub ci-status`
|
|
|
|
Then the exit status should be 2
|
2013-01-30 01:08:26 +04:00
|
|
|
And the output should contain exactly "pending\n"
|
2013-01-20 22:43:28 +04:00
|
|
|
|
|
|
|
Scenario: Exit status 3 for no statuses available
|
2013-01-30 01:08:26 +04:00
|
|
|
Given there is a commit named "the_sha"
|
|
|
|
Given the remote commit state of "michiels/pencilbox" "the_sha" is nil
|
2013-01-20 22:43:28 +04:00
|
|
|
When I run `hub ci-status the_sha`
|
|
|
|
Then the output should contain exactly "no status\n"
|
|
|
|
And the exit status should be 3
|
|
|
|
|
2013-10-29 03:56:00 +04:00
|
|
|
Scenario: Exit status 3 for no statuses available without URL
|
|
|
|
Given there is a commit named "the_sha"
|
|
|
|
Given the remote commit state of "michiels/pencilbox" "the_sha" is nil
|
|
|
|
When I run `hub ci-status -v the_sha`
|
|
|
|
Then the output should contain exactly "no status\n"
|
|
|
|
And the exit status should be 3
|
|
|
|
|
2013-01-30 01:08:26 +04:00
|
|
|
Scenario: Abort with message when invalid ref given
|
|
|
|
When I run `hub ci-status this-is-an-invalid-ref`
|
|
|
|
Then the exit status should be 1
|
|
|
|
And the output should contain exactly "Aborted: no revision could be determined from 'this-is-an-invalid-ref'\n"
|
|
|
|
|
2013-01-20 22:43:28 +04:00
|
|
|
Scenario: Non-GitHub repo
|
|
|
|
Given the "origin" remote has url "mygh:Manganeez/repo.git"
|
|
|
|
When I run `hub ci-status`
|
|
|
|
Then the stderr should contain "Aborted: the origin remote doesn't point to a GitHub repository.\n"
|
2013-01-30 01:08:26 +04:00
|
|
|
And the exit status should be 1
|