forked from mislav/hub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.feature
More file actions
898 lines (841 loc) · 27.1 KB
/
Copy pathrelease.feature
File metadata and controls
898 lines (841 loc) · 27.1 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
Feature: hub release
Background:
Given I am in "git://github.com/mislav/will_paginate.git" git repo
And I am "mislav" on github.com with OAuth token "OTOKEN"
Scenario: List non-draft releases
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: true,
prerelease: false,
},
{ tag_name: 'v1.2.0-pre',
name: 'will_paginate 1.2.0-pre',
draft: false,
prerelease: true,
},
{ tag_name: 'v1.0.2',
name: 'will_paginate 1.0.2',
draft: false,
prerelease: false,
},
]
}
"""
When I successfully run `hub release`
Then the output should contain exactly:
"""
v1.2.0-pre
v1.0.2\n
"""
Scenario: List non-prerelease releases
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: true,
prerelease: false,
},
{ tag_name: 'v1.2.0-pre',
name: 'will_paginate 1.2.0-pre',
draft: false,
prerelease: true,
},
{ tag_name: 'v1.0.2',
name: 'will_paginate 1.0.2',
draft: false,
prerelease: false,
},
]
}
"""
When I successfully run `hub release --exclude-prereleases`
Then the output should contain exactly:
"""
v1.0.2\n
"""
Scenario: List all releases
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: true,
prerelease: false,
},
{ tag_name: 'v1.2.0-pre',
name: 'will_paginate 1.2.0-pre',
draft: false,
prerelease: true,
},
{ tag_name: 'v1.0.2',
name: 'will_paginate 1.0.2',
draft: false,
prerelease: false,
},
]
}
"""
When I successfully run `hub release --include-drafts`
Then the output should contain exactly:
"""
v1.2.0
v1.2.0-pre
v1.0.2\n
"""
Scenario: Fetch releases across multiple pages
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
assert :per_page => "100", :page => :no
response.headers["Link"] = %(<https://api.github.com/repositories/12345?per_page=100&page=2>; rel="next")
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: false,
prerelease: false,
},
]
}
get('/repositories/12345') {
assert :per_page => "100"
if params[:page] == "2"
response.headers["Link"] = %(<https://api.github.com/repositories/12345?per_page=100&page=3>; rel="next")
json [
{ tag_name: 'v1.2.0-pre',
name: 'will_paginate 1.2.0-pre',
draft: false,
prerelease: true,
},
{ tag_name: 'v1.0.2',
name: 'will_paginate 1.0.2',
draft: false,
prerelease: false,
},
]
elsif params[:page] == "3"
json [
{ tag_name: 'v1.0.0',
name: 'will_paginate 1.0.0',
draft: false,
prerelease: true,
},
]
else
status 400
end
}
"""
When I successfully run `hub release`
Then the output should contain exactly:
"""
v1.2.0
v1.2.0-pre
v1.0.2
v1.0.0\n
"""
Scenario: List limited number of releases
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
response.headers["Link"] = %(<https://api.github.com/repositories/12345?per_page=100&page=2>; rel="next")
assert :per_page => "3"
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: false,
prerelease: false,
},
{ tag_name: 'v1.2.0-pre',
name: 'will_paginate 1.2.0-pre',
draft: false,
prerelease: true,
},
{ tag_name: 'v1.0.2',
name: 'will_paginate 1.0.2',
draft: false,
prerelease: false,
},
]
}
"""
When I successfully run `hub release -L 2`
Then the output should contain exactly:
"""
v1.2.0
v1.2.0-pre\n
"""
Scenario: Pretty-print releases
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: true,
prerelease: false,
created_at: '2018-02-27T19:35:32Z',
published_at: '2018-04-01T19:35:32Z',
assets: [
{browser_download_url: 'the://url', label: ''},
],
},
{ tag_name: 'v1.2.0-pre',
name: 'will_paginate 1.2.0-pre',
draft: false,
prerelease: true,
},
{ tag_name: 'v1.0.2',
name: 'will_paginate 1.0.2',
draft: false,
prerelease: false,
},
]
}
"""
When I successfully run `hub release --include-drafts --format='%t (%S)%n'`
Then the output should contain exactly:
"""
will_paginate 1.2.0 (draft)
will_paginate 1.2.0-pre (pre-release)
will_paginate 1.0.2 ()\n
"""
Scenario: Repository not found when listing releases
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
status 404
json message: "Not Found",
documentation_url: "https://developer.github.com/v3"
}
"""
When I run `hub release`
Then the stderr should contain exactly:
"""
Error fetching releases: Not Found (HTTP 404)
Not Found\n
"""
And the exit status should be 1
Scenario: Server error when listing releases
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
status 504
'<html><title>Its fine</title></html>'
}
"""
When I run `hub release`
Then the stderr should contain exactly:
"""
Error fetching releases: invalid character '<' looking for beginning of value (HTTP 504)\n
"""
And the exit status should be 1
Scenario: Show specific release
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: true,
prerelease: false,
tarball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.tar.gz",
zipball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.zip",
assets: [
{ browser_download_url: "https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip",
},
],
body: <<MARKDOWN
### Hello to my release
Here is what's broken:
- everything
MARKDOWN
},
]
}
"""
When I successfully run `hub release show v1.2.0`
Then the output should contain exactly:
"""
will_paginate 1.2.0
### Hello to my release
Here is what's broken:
- everything\n
"""
Scenario: Show specific release including downloads
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: true,
prerelease: false,
tarball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.tar.gz",
zipball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.zip",
assets: [
{ browser_download_url: "https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip",
},
],
body: <<MARKDOWN
### Hello to my release
Here is what's broken:
- everything
MARKDOWN
},
]
}
"""
When I successfully run `hub release show v1.2.0 --show-downloads`
Then the output should contain exactly:
"""
will_paginate 1.2.0
### Hello to my release
Here is what's broken:
- everything
## Downloads
https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip
https://github.com/mislav/will_paginate/archive/v1.2.0.zip
https://github.com/mislav/will_paginate/archive/v1.2.0.tar.gz\n
"""
Scenario: Format specific release
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: true,
prerelease: false,
tarball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.tar.gz",
zipball_url: "https://github.com/mislav/will_paginate/archive/v1.2.0.zip",
assets: [
{ browser_download_url: "https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip",
},
],
body: <<MARKDOWN
### Hello to my release
Here is what's broken:
- everything
MARKDOWN
},
]
}
"""
When I successfully run `hub release show v1.2.0 --format='%t (%T)%n%as%n%n%b%n'`
Then the output should contain exactly:
"""
will_paginate 1.2.0 (v1.2.0)
https://github.com/mislav/will_paginate/releases/download/v1.2.0/example.zip
### Hello to my release
Here is what's broken:
- everything\n
"""
Scenario: Show release no tag
When I run `hub release show`
Then the exit status should be 1
Then the stderr should contain "hub release show"
Scenario: Create a release
Given the GitHub API server:
"""
post('/repos/mislav/will_paginate/releases') {
assert :draft => true,
:tag_name => "v1.2.0",
:target_commitish => "",
:name => "will_paginate 1.2.0: Instant Gratification Monkey",
:body => ""
status 201
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0"
}
"""
When I successfully run `hub release create -dm "will_paginate 1.2.0: Instant Gratification Monkey" v1.2.0`
Then the output should contain exactly:
"""
https://github.com/mislav/will_paginate/releases/v1.2.0\n
"""
Scenario: Create a release from file
Given the GitHub API server:
"""
post('/repos/mislav/will_paginate/releases') {
assert :name => "Epic New Version",
:body => "body\ngoes\n\nhere"
status 201
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0"
}
"""
And a file named "message.txt" with:
"""
Epic New Version
body
goes
here
"""
When I successfully run `hub release create -F message.txt v1.2.0`
Then the output should contain exactly:
"""
https://github.com/mislav/will_paginate/releases/v1.2.0\n
"""
Scenario: Create a release with target commitish
Given the GitHub API server:
"""
post('/repos/mislav/will_paginate/releases') {
assert :tag_name => "v1.2.0",
:target_commitish => "my-branch"
status 201
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0"
}
"""
When I successfully run `hub release create -m hello v1.2.0 -t my-branch`
Then the output should contain exactly:
"""
https://github.com/mislav/will_paginate/releases/v1.2.0\n
"""
Scenario: Create a release with assets
Given the GitHub API server:
"""
post('/repos/mislav/will_paginate/releases') {
status 201
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0",
:upload_url => "https://uploads.github.com/uploads/assets{?name,label}"
}
post('/uploads/assets', :host_name => 'uploads.github.com') {
halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
assert :name => 'hello-1.2.0.tar.gz',
:label => 'Hello World'
status 201
}
"""
And a file named "hello-1.2.0.tar.gz" with:
"""
TARBALL
"""
When I successfully run `hub release create -m "hello" v1.2.0 -a "./hello-1.2.0.tar.gz#Hello World"`
Then the output should contain exactly:
"""
https://github.com/mislav/will_paginate/releases/v1.2.0
Attaching 1 asset...\n
"""
Scenario: Retry attaching assets on 5xx errors
Given the GitHub API server:
"""
attempt = 0
post('/repos/mislav/will_paginate/releases') {
status 201
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0",
:upload_url => "https://uploads.github.com/uploads/assets{?name,label}"
}
post('/uploads/assets', :host_name => 'uploads.github.com') {
attempt += 1
halt 400 unless request.body.read.to_s == "TARBALL"
halt 502 if attempt == 1
status 201
}
"""
And a file named "hello-1.2.0.tar.gz" with:
"""
TARBALL
"""
When I successfully run `hub release create -m "hello" v1.2.0 -a hello-1.2.0.tar.gz`
Then the output should contain exactly:
"""
https://github.com/mislav/will_paginate/releases/v1.2.0
Attaching 1 asset...\n
"""
Scenario: Create a release with some assets failing
Given the GitHub API server:
"""
post('/repos/mislav/will_paginate/releases') {
status 201
json :tag_name => "v1.2.0",
:html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0",
:upload_url => "https://uploads.github.com/uploads/assets{?name,label}"
}
post('/uploads/assets', :host_name => 'uploads.github.com') {
halt 422 if params[:name] == "two"
status 201
}
"""
And a file named "one" with:
"""
ONE
"""
And a file named "two" with:
"""
TWO
"""
And a file named "three" with:
"""
THREE
"""
When I run `hub release create -m "m" v1.2.0 -a one -a two -a three`
Then the exit status should be 1
Then the stderr should contain exactly:
"""
Attaching 3 assets...
The release was created, but attaching 2 assets failed. You can retry with:
hub release edit v1.2.0 -m '' -a two -a three
Error uploading release asset: Unprocessable Entity (HTTP 422)\n
"""
Scenario: Create a release with nonexistent asset
When I run `hub release create -m "hello" v1.2.0 -a "idontexis.tgz"`
Then the exit status should be 1
Then the stderr should contain exactly:
"""
open idontexis.tgz: no such file or directory\n
"""
Scenario: Open new release in web browser
Given the GitHub API server:
"""
post('/repos/mislav/will_paginate/releases') {
status 201
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0"
}
"""
When I successfully run `hub release create -o -m hello v1.2.0`
Then the output should contain exactly ""
And "open https://github.com/mislav/will_paginate/releases/v1.2.0" should be run
Scenario: Create release no tag
When I run `hub release create -m hello`
Then the exit status should be 1
Then the stderr should contain "hub release create"
Scenario: Edit existing release
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: true,
prerelease: false,
body: <<MARKDOWN
### Hello to my release
Here is what's broken:
- everything
MARKDOWN
},
]
}
patch('/repos/mislav/will_paginate/releases/123') {
assert :name => 'KITTENS EVERYWHERE',
:draft => false,
:prerelease => nil
json({})
}
"""
Given the git commit editor is "vim"
And the text editor adds:
"""
KITTENS EVERYWHERE
"""
When I successfully run `hub release edit --draft=false v1.2.0`
Then the output should not contain anything
Scenario: Edit existing release when there is a fork
Given the "doge" remote has url "git://github.com/doge/will_paginate.git"
And I am on the "feature" branch with upstream "doge/feature"
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
tag_name: 'v1.2.0',
},
]
}
patch('/repos/mislav/will_paginate/releases/123') {
json({})
}
"""
When I successfully run `hub release edit -m "" v1.2.0`
Then the output should not contain anything
Scenario: Edit existing release no title
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
},
]
}
"""
And a file named "message.txt" with:
"""
"""
When I run `hub release edit v1.2.0 -F message.txt`
Then the exit status should be 1
And the stderr should contain exactly:
"""
Aborting editing due to empty release title\n
"""
Scenario: Edit existing release by uploading assets
Given the GitHub API server:
"""
deleted = false
get('/repos/mislav/will_paginate/releases') {
json [
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
upload_url: 'https://uploads.github.com/uploads/assets{?name,label}',
tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: true,
prerelease: false,
assets: [
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/456',
name: 'hello-1.2.0.tar.gz',
},
],
},
]
}
delete('/repos/mislav/will_paginate/assets/456') {
deleted = true
status 204
}
post('/uploads/assets', :host_name => 'uploads.github.com') {
halt 422 unless deleted
halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
assert :name => 'hello-1.2.0.tar.gz',
:label => nil
status 201
}
"""
And a file named "hello-1.2.0.tar.gz" with:
"""
TARBALL
"""
When I successfully run `hub release edit -m "" v1.2.0 -a hello-1.2.0.tar.gz`
Then the output should contain exactly:
"""
Attaching 1 asset...\n
"""
Scenario: Edit release no tag
When I run `hub release edit -m hello`
Then the exit status should be 1
Then the stderr should contain "hub release edit"
Scenario: Download a release asset
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
assets: [
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
name: 'hello-1.2.0.tar.gz',
},
],
},
]
}
get('/repos/mislav/will_paginate/assets/9876') {
halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
halt 415 unless request.accept?('application/octet-stream')
status 302
headers['Location'] = 'https://github-cloud.s3.amazonaws.com/releases/12204602/22ea221a-cf2f-11e2-222a-b3a3c3b3aa3a.gz'
""
}
get('/releases/12204602/22ea221a-cf2f-11e2-222a-b3a3c3b3aa3a.gz', :host_name => 'github-cloud.s3.amazonaws.com') {
halt 400 unless request.env['HTTP_AUTHORIZATION'].nil?
halt 415 unless request.accept?('application/octet-stream')
headers['Content-Type'] = 'application/octet-stream'
"ASSET_TARBALL"
}
"""
When I successfully run `hub release download v1.2.0`
Then the output should contain exactly:
"""
Downloading hello-1.2.0.tar.gz ...\n
"""
And the file "hello-1.2.0.tar.gz" should contain exactly:
"""
ASSET_TARBALL
"""
Scenario: Download release assets that match pattern
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
assets: [
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
name: 'hello-amd32-1.2.0.tar.gz',
},
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9877',
name: 'hello-amd64-1.2.0.tar.gz',
},
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9878',
name: 'hello-x86-1.2.0.tar.gz',
},
],
},
]
}
get('/repos/mislav/will_paginate/assets/9876') { "TARBALL" }
get('/repos/mislav/will_paginate/assets/9877') { "TARBALL" }
"""
When I successfully run `hub release download v1.2.0 --include '*amd*'`
Then the output should contain exactly:
"""
Downloading hello-amd32-1.2.0.tar.gz ...
Downloading hello-amd64-1.2.0.tar.gz ...\n
"""
And the file "hello-x86-1.2.0.tar.gz" should not exist
Scenario: Glob pattern allows exact match
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
assets: [
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
name: 'hello-amd32-1.2.0.tar.gz',
},
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9877',
name: 'hello-amd64-1.2.0.tar.gz',
},
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9878',
name: 'hello-x86-1.2.0.tar.gz',
},
],
},
]
}
get('/repos/mislav/will_paginate/assets/9876') { "ASSET_TARBALL" }
"""
When I successfully run `hub release download v1.2.0 --include hello-amd32-1.2.0.tar.gz`
Then the output should contain exactly:
"""
Downloading hello-amd32-1.2.0.tar.gz ...\n
"""
And the file "hello-amd32-1.2.0.tar.gz" should contain exactly:
"""
ASSET_TARBALL
"""
And the file "hello-amd64-1.2.0.tar.gz" should not exist
And the file "hello-x86-1.2.0.tar.gz" should not exist
Scenario: Advanced glob pattern
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
assets: [
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
name: 'hello-amd32-1.2.0.tar.gz',
},
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
name: 'hello-amd32-1.2.1.tar.gz',
},
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
name: 'hello-amd32-1.2.2.tar.gz',
},
],
},
]
}
get('/repos/mislav/will_paginate/assets/9876') { "ASSET_TARBALL" }
"""
When I successfully run `hub release download v1.2.0 --include '*-amd32-?.?.[01].tar.gz'`
Then the output should contain exactly:
"""
Downloading hello-amd32-1.2.0.tar.gz ...
Downloading hello-amd32-1.2.1.tar.gz ...\n
"""
Scenario: No matches for download pattern
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ tag_name: 'v1.2.0',
assets: [
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
name: 'hello-amd32-1.2.0.tar.gz',
},
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
name: 'hello-amd32-1.2.1.tar.gz',
},
{ url: 'https://api.github.com/repos/mislav/will_paginate/assets/9876',
name: 'hello-amd32-1.2.2.tar.gz',
},
],
},
]
}
"""
When I run `hub release download v1.2.0 --include amd32`
Then the exit status should be 1
Then the stderr should contain exactly:
"""
the `--include` pattern did not match any available assets:
hello-amd32-1.2.0.tar.gz
hello-amd32-1.2.1.tar.gz
hello-amd32-1.2.2.tar.gz\n
"""
Scenario: Download release no tag
When I run `hub release download`
Then the exit status should be 1
Then the stderr should contain "hub release download"
Scenario: Delete a release
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
json [
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
tag_name: 'v1.2.0',
},
]
}
delete('/repos/mislav/will_paginate/releases/123') {
status 204
}
"""
When I successfully run `hub release delete v1.2.0`
Then the output should not contain anything
Scenario: Release not found
Given the GitHub API server:
"""
get('/repos/mislav/will_paginate/releases') {
assert :per_page => "100"
json [
{ url: 'https://api.github.com/repos/mislav/will_paginate/releases/123',
tag_name: 'v1.2.0',
},
]
}
delete('/repos/mislav/will_paginate/releases/123') {
status 204
}
"""
When I run `hub release delete v2.0`
Then the exit status should be 1
And the stderr should contain exactly:
"""
Unable to find release with tag name `v2.0'\n
"""
Scenario: Enterprise list releases
Given the "origin" remote has url "git@git.my.org:mislav/will_paginate.git"
And I am "mislav" on git.my.org with OAuth token "FITOKEN"
And "git.my.org" is a whitelisted Enterprise host
Given the GitHub API server:
"""
get('/api/v3/repos/mislav/will_paginate/releases', :host_name => 'git.my.org') {
json [
{ tag_name: 'v1.2.0',
name: 'will_paginate 1.2.0',
draft: false,
prerelease: false,
},
]
}
"""
When I successfully run `hub release`
Then the output should contain exactly:
"""
v1.2.0\n
"""