github.com/pengwynn/gh@v1.0.1-0.20140118055701-14327ca3942e/features/fetch.feature (about) 1 Feature: hub fetch 2 Background: 3 Given I am in "dotfiles" git repo 4 And the "origin" remote has url "git://github.com/evilchelu/dotfiles.git" 5 And I am "mislav" on github.com with OAuth token "OTOKEN" 6 7 Scenario: Fetch existing remote 8 When I successfully run `hub fetch origin` 9 Then "git fetch origin" should be run 10 And there should be no output 11 12 Scenario: Creates new remote 13 Given the GitHub API server: 14 """ 15 get('/repos/mislav/dotfiles') { json :private => false } 16 """ 17 When I successfully run `hub fetch mislav` 18 Then "git fetch mislav" should be run 19 And the url for "mislav" should be "git://github.com/mislav/dotfiles.git" 20 And there should be no output 21 22 Scenario: Owner name with dash 23 Given the GitHub API server: 24 """ 25 get('/repos/ankit-maverick/dotfiles') { json :private => false } 26 """ 27 When I successfully run `hub fetch ankit-maverick` 28 Then "git fetch ankit-maverick" should be run 29 And the url for "ankit-maverick" should be "git://github.com/ankit-maverick/dotfiles.git" 30 And there should be no output 31 32 Scenario: HTTPS is preferred 33 Given the GitHub API server: 34 """ 35 get('/repos/mislav/dotfiles') { json :private => false } 36 """ 37 And HTTPS is preferred 38 When I successfully run `hub fetch mislav` 39 Then "git fetch mislav" should be run 40 And the url for "mislav" should be "https://github.com/mislav/dotfiles.git" 41 42 Scenario: Private repo 43 Given the GitHub API server: 44 """ 45 get('/repos/mislav/dotfiles') { json :private => true } 46 """ 47 When I successfully run `hub fetch mislav` 48 Then "git fetch mislav" should be run 49 And the url for "mislav" should be "git@github.com:mislav/dotfiles.git" 50 And there should be no output 51 52 Scenario: Fetch with options 53 Given the GitHub API server: 54 """ 55 get('/repos/mislav/dotfiles') { json :private => false } 56 """ 57 When I successfully run `hub fetch --depth=1 mislav` 58 Then "git fetch --depth=1 mislav" should be run 59 60 Scenario: Fetch multiple 61 Given the GitHub API server: 62 """ 63 get('/repos/:owner/dotfiles') { json :private => false } 64 """ 65 When I successfully run `hub fetch --multiple mislav rtomayko` 66 Then "git fetch --multiple mislav rtomayko" should be run 67 And the url for "mislav" should be "git://github.com/mislav/dotfiles.git" 68 And the url for "rtomayko" should be "git://github.com/rtomayko/dotfiles.git" 69 70 Scenario: Fetch multiple with filtering 71 Given the GitHub API server: 72 """ 73 get('/repos/mislav/dotfiles') { json :private => false } 74 """ 75 When I successfully run `git config remotes.mygrp "foo bar"` 76 When I successfully run `hub fetch --multiple origin mislav mygrp git://example.com typo` 77 Then "git fetch --multiple origin mislav mygrp git://example.com typo" should be run 78 And the url for "mislav" should be "git://github.com/mislav/dotfiles.git" 79 But there should be no "mygrp" remote 80 And there should be no "typo" remote 81 82 Scenario: Fetch multiple comma-separated 83 Given the GitHub API server: 84 """ 85 get('/repos/:owner/dotfiles') { json :private => false } 86 """ 87 When I successfully run `hub fetch mislav,rtomayko` 88 Then "git fetch --multiple mislav rtomayko" should be run 89 And the url for "mislav" should be "git://github.com/mislav/dotfiles.git" 90 And the url for "rtomayko" should be "git://github.com/rtomayko/dotfiles.git" 91 92 Scenario: Doesn't create a new remote if repo doesn't exist on GitHub 93 Given the GitHub API server: 94 """ 95 get('/repos/mislav/dotfiles') { status 404 } 96 """ 97 When I successfully run `hub fetch mislav` 98 Then "git fetch mislav" should be run 99 And there should be no "mislav" remote