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