forked from mislav/hub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremote_add.feature
More file actions
231 lines (205 loc) · 8.87 KB
/
Copy pathremote_add.feature
File metadata and controls
231 lines (205 loc) · 8.87 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
Feature: hub remote add
Background:
Given I am "EvilChelu" on GitHub.com
And I am in "dotfiles" git repo
Scenario: Add origin remote for my own repo
Given there are no remotes
When I successfully run `hub remote add origin`
Then the url for "origin" should be "git@github.com:EvilChelu/dotfiles.git"
And the output should not contain anything
Scenario: Add origin remote for my own repo using -C
Given there are no remotes
And I cd to ".."
When I successfully run `hub -C dotfiles remote add origin`
And I cd to "dotfiles"
Then the url for "origin" should be "git@github.com:EvilChelu/dotfiles.git"
And the output should not contain anything
Scenario: Unchanged public remote add
When I successfully run `hub remote add origin http://github.com/defunkt/resque.git`
Then the url for "origin" should be "http://github.com/defunkt/resque.git"
And the output should not contain anything
Scenario: Unchanged private remote add
When I successfully run `hub remote add origin git@github.com:defunkt/resque.git`
Then the url for "origin" should be "git@github.com:defunkt/resque.git"
And the output should not contain anything
Scenario: Unchanged local path remote add
When I successfully run `hub remote add myremote ./path`
Then the git command should be unchanged
And the output should not contain anything
Scenario: Unchanged local absolute path remote add
When I successfully run `hub remote add myremote /path`
Then the git command should be unchanged
And the output should not contain anything
Scenario: Unchanged remote add with host alias
When I successfully run `hub remote add myremote server:/git/repo.git`
Then the git command should be unchanged
And the output should not contain anything
Scenario: Add new remote for Enterprise repo
Given "git.my.org" is a whitelisted Enterprise host
And I am "ProLoser" on git.my.org with OAuth token "FITOKEN"
And the "origin" remote has url "git@git.my.org:mislav/topsekrit.git"
When I successfully run `hub remote add another`
Then the url for "another" should be "git@git.my.org:another/topsekrit.git"
And the output should not contain anything
Scenario: Add public remote
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles') {
json :private => false,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => false }
}
"""
When I successfully run `hub remote add mislav`
Then the url for "mislav" should be "git://github.com/mislav/dotfiles.git"
And the output should not contain anything
Scenario: Add detected private remote
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles') {
json :private => true,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => false }
}
"""
When I successfully run `hub remote add mislav`
Then the url for "mislav" should be "git@github.com:mislav/dotfiles.git"
And the output should not contain anything
Scenario: Add remote with push access
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles') {
json :private => false,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => true }
}
"""
When I successfully run `hub remote add mislav`
Then the url for "mislav" should be "git@github.com:mislav/dotfiles.git"
And the output should not contain anything
Scenario: Add remote for missing repo
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles') {
status 404
}
"""
When I run `hub remote add mislav`
Then the exit status should be 1
And the output should contain exactly:
"""
Error: repository mislav/dotfiles doesn't exist\n
"""
Scenario: Add explicitly private remote
When I successfully run `hub remote add -p mislav`
Then the url for "mislav" should be "git@github.com:mislav/dotfiles.git"
And the output should not contain anything
Scenario: Remote for my own repo is automatically private
When I successfully run `hub remote add evilchelu`
Then the url for "evilchelu" should be "git@github.com:EvilChelu/dotfiles.git"
And the output should not contain anything
Scenario: Add remote with arguments
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles') {
json :private => false,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => false }
}
"""
When I successfully run `hub remote add -f mislav`
Then "git remote add -f mislav git://github.com/mislav/dotfiles.git" should be run
And the output should not contain anything
Scenario: Add remote with branch argument
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles') {
json :private => false,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => false }
}
"""
When I successfully run `hub remote add -f -t feature mislav`
Then "git remote add -f -t feature mislav git://github.com/mislav/dotfiles.git" should be run
And the output should not contain anything
Scenario: Add HTTPS protocol remote
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles') {
json :private => false,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => false }
}
"""
Given HTTPS is preferred
When I successfully run `hub remote add mislav`
Then the url for "mislav" should be "https://github.com/mislav/dotfiles.git"
And the output should not contain anything
Scenario: Add named public remote
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles') {
json :private => false,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => false }
}
"""
When I successfully run `hub remote add mm mislav`
Then the url for "mm" should be "git://github.com/mislav/dotfiles.git"
And the output should not contain anything
Scenario: set-url
Given the GitHub API server:
"""
get('/repos/mislav/dotfiles') {
json :private => false,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => false }
}
"""
Given the "origin" remote has url "git://github.com/evilchelu/dotfiles.git"
When I successfully run `hub remote set-url origin mislav`
Then the url for "origin" should be "git://github.com/mislav/dotfiles.git"
And the output should not contain anything
Scenario: Add public remote including repo name
Given the GitHub API server:
"""
get('/repos/mislav/dotfilez.js') {
json :private => false,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => false }
}
"""
When I successfully run `hub remote add mislav/dotfilez.js`
Then the url for "mislav" should be "git://github.com/mislav/dotfilez.js.git"
And the output should not contain anything
Scenario: Add named public remote including repo name
Given the GitHub API server:
"""
get('/repos/mislav/dotfilez.js') {
json :private => false,
:name => 'dotfiles', :owner => { :login => 'mislav' },
:permissions => { :push => false }
}
"""
When I successfully run `hub remote add mm mislav/dotfilez.js`
Then the url for "mm" should be "git://github.com/mislav/dotfilez.js.git"
And the output should not contain anything
Scenario: Add named private remote
When I successfully run `hub remote add -p mm mislav`
Then the url for "mm" should be "git@github.com:mislav/dotfiles.git"
And the output should not contain anything
Scenario: Add private remote including repo name
When I successfully run `hub remote add -p mislav/dotfilez.js`
Then the url for "mislav" should be "git@github.com:mislav/dotfilez.js.git"
And the output should not contain anything
Scenario: Add named private remote including repo name
When I successfully run `hub remote add -p mm mislav/dotfilez.js`
Then the url for "mm" should be "git@github.com:mislav/dotfilez.js.git"
And the output should not contain anything
Scenario: Add named private remote for my own repo including repo name
When I successfully run `hub remote add ec evilchelu/dotfilez.js`
Then the url for "ec" should be "git@github.com:EvilChelu/dotfilez.js.git"
And the output should not contain anything
Scenario: Avoid crash in argument parsing
When I successfully run `hub --noop remote add a b evilchelu`
Then the output should contain exactly "git remote add a b evilchelu\n"