github.com/echohead/hub@v2.2.1+incompatible/features/ci_status.feature (about)

     1  Feature: hub ci-status
     2  
     3    Background:
     4      Given I am in "git://github.com/michiels/pencilbox.git" git repo
     5      And I am "michiels" on github.com with OAuth token "OTOKEN"
     6  
     7    Scenario: Fetch commit SHA
     8      Given there is a commit named "the_sha"
     9      Given the remote commit state of "michiels/pencilbox" "the_sha" is "success"
    10      When I run `hub ci-status the_sha`
    11      Then the output should contain exactly "success\n"
    12      And the exit status should be 0
    13  
    14    Scenario: Fetch commit SHA with URL
    15      Given there is a commit named "the_sha"
    16      Given the remote commit state of "michiels/pencilbox" "the_sha" is "success"
    17      When I run `hub ci-status the_sha -v`
    18      Then the output should contain "success: https://travis-ci.org/michiels/pencilbox/builds/1234567"
    19      And the exit status should be 0
    20  
    21    Scenario: Multiple statuses, latest is passing
    22      Given there is a commit named "the_sha"
    23      Given the remote commit states of "michiels/pencilbox" "the_sha" are:
    24        """
    25        [ { :state => 'success' },
    26          { :state => 'pending' }  ]
    27        """
    28      When I run `hub ci-status the_sha`
    29      Then the output should contain exactly "success\n"
    30      And the exit status should be 0
    31  
    32    Scenario: Exit status 1 for 'error' and 'failure'
    33      Given the remote commit state of "michiels/pencilbox" "HEAD" is "error"
    34      When I run `hub ci-status`
    35      Then the exit status should be 1
    36      And the output should contain exactly "error\n"
    37  
    38    Scenario: Use HEAD when no sha given
    39      Given the remote commit state of "michiels/pencilbox" "HEAD" is "pending"
    40      When I run `hub ci-status`
    41      Then the exit status should be 2
    42      And the output should contain exactly "pending\n"
    43  
    44    Scenario: Exit status 3 for no statuses available
    45      Given there is a commit named "the_sha"
    46      Given the remote commit state of "michiels/pencilbox" "the_sha" is nil
    47      When I run `hub ci-status the_sha`
    48      Then the output should contain exactly "no status\n"
    49      And the exit status should be 3
    50  
    51    Scenario: Exit status 3 for no statuses available without URL
    52      Given there is a commit named "the_sha"
    53      Given the remote commit state of "michiels/pencilbox" "the_sha" is nil
    54      When I run `hub ci-status -v the_sha`
    55      Then the output should contain exactly "no status\n"
    56      And the exit status should be 3
    57  
    58    Scenario: Abort with message when invalid ref given
    59      When I run `hub ci-status this-is-an-invalid-ref`
    60      Then the exit status should be 1
    61      And the output should contain exactly "Aborted: no revision could be determined from 'this-is-an-invalid-ref'\n"
    62  
    63    Scenario: Non-GitHub repo
    64      Given the "origin" remote has url "mygh:Manganeez/repo.git"
    65      When I run `hub ci-status`
    66      Then the stderr should contain "Aborted: the origin remote doesn't point to a GitHub repository.\n"
    67      And the exit status should be 1