gitlab 3.7.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +24 -0
- data/README.md +7 -6
- data/gitlab.gemspec +4 -6
- data/lib/gitlab/client.rb +24 -0
- data/lib/gitlab/client/branches.rb +13 -13
- data/lib/gitlab/client/build_triggers.rb +9 -9
- data/lib/gitlab/client/build_variables.rb +11 -11
- data/lib/gitlab/client/builds.rb +16 -16
- data/lib/gitlab/client/commits.rb +39 -14
- data/lib/gitlab/client/groups.rb +1 -1
- data/lib/gitlab/client/issues.rb +40 -16
- data/lib/gitlab/client/labels.rb +9 -9
- data/lib/gitlab/client/merge_requests.rb +61 -24
- data/lib/gitlab/client/milestones.rb +25 -11
- data/lib/gitlab/client/namespaces.rb +2 -1
- data/lib/gitlab/client/notes.rb +16 -16
- data/lib/gitlab/client/pipelines.rb +68 -0
- data/lib/gitlab/client/projects.rb +111 -49
- data/lib/gitlab/client/repositories.rb +27 -23
- data/lib/gitlab/client/repository_files.rb +29 -10
- data/lib/gitlab/client/runners.rb +15 -15
- data/lib/gitlab/client/services.rb +8 -6
- data/lib/gitlab/client/snippets.rb +13 -13
- data/lib/gitlab/client/system_hooks.rb +1 -1
- data/lib/gitlab/client/tags.rb +13 -13
- data/lib/gitlab/client/users.rb +12 -5
- data/lib/gitlab/file_response.rb +1 -0
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/merge_request_closes_issues.json +1 -0
- data/spec/fixtures/milestone_merge_requests.json +1 -0
- data/spec/fixtures/pipeline.json +23 -0
- data/spec/fixtures/pipeline_cancel.json +23 -0
- data/spec/fixtures/pipeline_create.json +23 -0
- data/spec/fixtures/pipeline_retry.json +23 -0
- data/spec/fixtures/pipelines.json +48 -0
- data/spec/fixtures/project_commit_create.json +22 -0
- data/spec/fixtures/project_star.json +44 -0
- data/spec/fixtures/project_unstar.json +44 -0
- data/spec/fixtures/{git_hook.json → push_rule.json} +0 -0
- data/spec/gitlab/cli_spec.rb +9 -0
- data/spec/gitlab/client/client_spec.rb +11 -0
- data/spec/gitlab/client/commits_spec.rb +31 -0
- data/spec/gitlab/client/issues_spec.rb +48 -0
- data/spec/gitlab/client/merge_requests_spec.rb +57 -10
- data/spec/gitlab/client/milestones_spec.rb +16 -0
- data/spec/gitlab/client/pipelines_spec.rb +95 -0
- data/spec/gitlab/client/projects_spec.rb +116 -38
- data/spec/gitlab/client/repositories_spec.rb +0 -15
- data/spec/gitlab/client/repository_files_spec.rb +17 -2
- data/spec/gitlab/client/users_spec.rb +31 -13
- data/spec/gitlab/file_response_spec.rb +6 -1
- metadata +53 -43
@@ -19,12 +19,12 @@ describe Gitlab::Client do
|
|
19
19
|
|
20
20
|
describe ".merge_request" do
|
21
21
|
before do
|
22
|
-
stub_get("/projects/3/
|
22
|
+
stub_get("/projects/3/merge_requests/1", "merge_request")
|
23
23
|
@merge_request = Gitlab.merge_request(3, 1)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should get the correct resource" do
|
27
|
-
expect(a_get("/projects/3/
|
27
|
+
expect(a_get("/projects/3/merge_requests/1")).to have_been_made
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should return information about a merge request" do
|
@@ -50,7 +50,7 @@ describe Gitlab::Client do
|
|
50
50
|
|
51
51
|
describe ".update_merge_request" do
|
52
52
|
before do
|
53
|
-
stub_put("/projects/3/
|
53
|
+
stub_put("/projects/3/merge_requests/2", "merge_request").
|
54
54
|
with(body: {
|
55
55
|
assignee_id: '1',
|
56
56
|
target_branch: 'master',
|
@@ -64,7 +64,7 @@ describe Gitlab::Client do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should get the correct resource" do
|
67
|
-
expect(a_put("/projects/3/
|
67
|
+
expect(a_put("/projects/3/merge_requests/2").
|
68
68
|
with(body: {
|
69
69
|
assignee_id: '1',
|
70
70
|
target_branch: 'master',
|
@@ -80,13 +80,13 @@ describe Gitlab::Client do
|
|
80
80
|
|
81
81
|
describe ".accept_merge_request" do
|
82
82
|
before do
|
83
|
-
stub_put("/projects/5/
|
83
|
+
stub_put("/projects/5/merge_requests/42/merge", "merge_request").
|
84
84
|
with(body: { merge_commit_message: 'Nice!' })
|
85
85
|
@merge_request = Gitlab.accept_merge_request(5, 42, merge_commit_message: 'Nice!')
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should get the correct resource" do
|
89
|
-
expect(a_put("/projects/5/
|
89
|
+
expect(a_put("/projects/5/merge_requests/42/merge").
|
90
90
|
with(body: { merge_commit_message: 'Nice!' })).to have_been_made
|
91
91
|
end
|
92
92
|
|
@@ -134,12 +134,12 @@ describe Gitlab::Client do
|
|
134
134
|
|
135
135
|
describe ".merge_request_changes" do
|
136
136
|
before do
|
137
|
-
stub_get("/projects/3/
|
137
|
+
stub_get("/projects/3/merge_requests/2/changes", "merge_request_changes")
|
138
138
|
@mr_changes = Gitlab.merge_request_changes(3, 2)
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should get the correct resource" do
|
142
|
-
expect(a_get("/projects/3/
|
142
|
+
expect(a_get("/projects/3/merge_requests/2/changes")).to have_been_made
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should return the merge request changes" do
|
@@ -154,12 +154,12 @@ describe Gitlab::Client do
|
|
154
154
|
|
155
155
|
describe ".merge_request_commits" do
|
156
156
|
before do
|
157
|
-
stub_get("/projects/3/
|
157
|
+
stub_get("/projects/3/merge_requests/2/commits", "merge_request_commits")
|
158
158
|
@mr_commits = Gitlab.merge_request_commits(3, 2)
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should get the correct resource" do
|
162
|
-
expect(a_get("/projects/3/
|
162
|
+
expect(a_get("/projects/3/merge_requests/2/commits")).to have_been_made
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should return the merge request commits" do
|
@@ -174,4 +174,51 @@ describe Gitlab::Client do
|
|
174
174
|
expect(@mr_commits[1].title).to eq "hoge"
|
175
175
|
end
|
176
176
|
end
|
177
|
+
|
178
|
+
describe ".merge_request_closes_issues" do
|
179
|
+
before do
|
180
|
+
stub_get("/projects/5/merge_requests/1/closes_issues", "merge_request_closes_issues")
|
181
|
+
@issues = Gitlab.merge_request_closes_issues(5, 1)
|
182
|
+
end
|
183
|
+
|
184
|
+
it "should get the correct resource" do
|
185
|
+
expect(a_get("/projects/5/merge_requests/1/closes_issues")).to have_been_made
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should return a paginated response of the issues the merge_request will close" do
|
189
|
+
expect(@issues).to be_a(Gitlab::PaginatedResponse)
|
190
|
+
expect(@issues.first.title).to eq("Merge request 1 issue 1")
|
191
|
+
expect(@issues.size).to eq(2)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe ".subscribe_to_merge_request" do
|
196
|
+
before do
|
197
|
+
stub_post("/projects/3/merge_requests/2/subscribe", "merge_request")
|
198
|
+
@merge_request = Gitlab.subscribe_to_merge_request(3, 2)
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should get the correct resource" do
|
202
|
+
expect(a_post("/projects/3/merge_requests/2/subscribe")).to have_been_made
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should return information about a merge request" do
|
206
|
+
expect(@merge_request.project_id).to eq(3)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
describe ".unsubscribe_from_merge_request" do
|
211
|
+
before do
|
212
|
+
stub_post("/projects/3/merge_requests/2/unsubscribe", "merge_request")
|
213
|
+
@merge_request = Gitlab.unsubscribe_from_merge_request(3, 2)
|
214
|
+
end
|
215
|
+
|
216
|
+
it "should get the correct resource" do
|
217
|
+
expect(a_post("/projects/3/merge_requests/2/unsubscribe")).to have_been_made
|
218
|
+
end
|
219
|
+
|
220
|
+
it "should return information about a merge request" do
|
221
|
+
expect(@merge_request.project_id).to eq(3)
|
222
|
+
end
|
223
|
+
end
|
177
224
|
end
|
@@ -48,6 +48,22 @@ describe Gitlab::Client do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
describe ".milestone_merge_requests" do
|
52
|
+
before do
|
53
|
+
stub_get("/projects/3/milestones/1/merge_requests", "milestone_merge_requests")
|
54
|
+
@milestone_merge_requests = Gitlab.milestone_merge_requests(3, 1)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should get the correct resource" do
|
58
|
+
expect(a_get("/projects/3/milestones/1/merge_requests")).to have_been_made
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should return a paginated response of milestone's merge_requests" do
|
62
|
+
expect(@milestone_merge_requests).to be_a Gitlab::PaginatedResponse
|
63
|
+
expect(@milestone_merge_requests.first.milestone.id).to eq(1)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
51
67
|
describe ".create_milestone" do
|
52
68
|
before do
|
53
69
|
stub_post("/projects/3/milestones", "milestone")
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gitlab::Client do
|
4
|
+
describe ".pipelines" do
|
5
|
+
before do
|
6
|
+
stub_get("/projects/3/pipelines", "pipelines")
|
7
|
+
@pipelines = Gitlab.pipelines(3)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should get the correct resource" do
|
11
|
+
expect(a_get("/projects/3/pipelines")).to have_been_made
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return a paginated response of project's pipelines" do
|
15
|
+
expect(@pipelines).to be_a Gitlab::PaginatedResponse
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".pipeline" do
|
20
|
+
before do
|
21
|
+
stub_get("/projects/3/pipelines/46", "pipeline")
|
22
|
+
@pipeline = Gitlab.pipeline(3, 46)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should get the correct resource" do
|
26
|
+
expect(a_get("/projects/3/pipelines/46")).to have_been_made
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should return a single pipeline" do
|
30
|
+
expect(@pipeline).to be_a Gitlab::ObjectifiedHash
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should return information about a pipeline" do
|
34
|
+
expect(@pipeline.id).to eq(46)
|
35
|
+
expect(@pipeline.user.name).to eq("Administrator")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe ".create_pipeline" do
|
40
|
+
before do
|
41
|
+
stub_post("/projects/3/pipeline?ref=master", "pipeline_create")
|
42
|
+
@pipeline_create = Gitlab.create_pipeline(3, 'master')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should get the correct resource" do
|
46
|
+
expect(a_post("/projects/3/pipeline?ref=master")).to have_been_made
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should return a single pipeline" do
|
50
|
+
expect(@pipeline_create).to be_a Gitlab::ObjectifiedHash
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return information about a pipeline" do
|
54
|
+
expect(@pipeline_create.user.name).to eq("Administrator")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe ".cancel_pipeline" do
|
59
|
+
before do
|
60
|
+
stub_post("/projects/3/pipelines/46/cancel", "pipeline_cancel")
|
61
|
+
@pipeline_cancel = Gitlab.cancel_pipeline(3, 46)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should get the correct resource" do
|
65
|
+
expect(a_post("/projects/3/pipelines/46/cancel")).to have_been_made
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should return a single pipeline" do
|
69
|
+
expect(@pipeline_cancel).to be_a Gitlab::ObjectifiedHash
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should return information about a pipeline" do
|
73
|
+
expect(@pipeline_cancel.user.name).to eq("Administrator")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe ".retry_pipeline" do
|
78
|
+
before do
|
79
|
+
stub_post("/projects/3/pipelines/46/retry", "pipeline_retry")
|
80
|
+
@pipeline_retry = Gitlab.retry_pipeline(3, 46)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should get the correct resource" do
|
84
|
+
expect(a_post("/projects/3/pipelines/46/retry")).to have_been_made
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should return a single pipeline" do
|
88
|
+
expect(@pipeline_retry).to be_a Gitlab::ObjectifiedHash
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should return information about a pipeline" do
|
92
|
+
expect(@pipeline_retry.user.name).to eq("Administrator")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -122,12 +122,12 @@ describe Gitlab::Client do
|
|
122
122
|
describe ".create_fork" do
|
123
123
|
context "without sudo option" do
|
124
124
|
before do
|
125
|
-
stub_post("/projects/fork
|
125
|
+
stub_post("/projects/3/fork", "project_fork")
|
126
126
|
@project = Gitlab.create_fork(3)
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should post to the correct resource" do
|
130
|
-
expect(a_post("/projects/fork
|
130
|
+
expect(a_post("/projects/3/fork")).to have_been_made
|
131
131
|
end
|
132
132
|
|
133
133
|
it "should return information about the forked project" do
|
@@ -138,13 +138,13 @@ describe Gitlab::Client do
|
|
138
138
|
|
139
139
|
context "with the sudo option" do
|
140
140
|
before do
|
141
|
-
stub_post("/projects/fork
|
141
|
+
stub_post("/projects/3/fork", "project_forked_for_user")
|
142
142
|
@sudoed_username = 'jack.smith'
|
143
143
|
@project = Gitlab.create_fork(3, sudo: @sudoed_username)
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should post to the correct resource" do
|
147
|
-
expect(a_post("/projects/fork
|
147
|
+
expect(a_post("/projects/3/fork")).to have_been_made
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should return information about the forked project" do
|
@@ -363,81 +363,81 @@ describe Gitlab::Client do
|
|
363
363
|
end
|
364
364
|
end
|
365
365
|
|
366
|
-
describe ".
|
366
|
+
describe ".push_rule" do
|
367
367
|
before do
|
368
|
-
stub_get("/projects/1/
|
369
|
-
@
|
368
|
+
stub_get("/projects/1/push_rule", "push_rule")
|
369
|
+
@push_rule = Gitlab.push_rule(1)
|
370
370
|
end
|
371
371
|
|
372
372
|
it "should get the correct resource" do
|
373
|
-
expect(a_get("/projects/1/
|
373
|
+
expect(a_get("/projects/1/push_rule")).to have_been_made
|
374
374
|
end
|
375
375
|
|
376
|
-
it "should return information about a
|
377
|
-
expect(@
|
376
|
+
it "should return information about a push rule" do
|
377
|
+
expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
378
378
|
end
|
379
379
|
end
|
380
380
|
|
381
|
-
describe ".
|
381
|
+
describe ".add_push_rule" do
|
382
382
|
before do
|
383
|
-
stub_post("/projects/1/
|
384
|
-
@
|
383
|
+
stub_post("/projects/1/push_rule", "push_rule")
|
384
|
+
@push_rule = Gitlab.add_push_rule(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" })
|
385
385
|
end
|
386
386
|
|
387
387
|
it "should get the correct resource" do
|
388
|
-
expect(a_post("/projects/1/
|
388
|
+
expect(a_post("/projects/1/push_rule")).to have_been_made
|
389
389
|
end
|
390
390
|
|
391
|
-
it "should return information about an added
|
392
|
-
expect(@
|
391
|
+
it "should return information about an added push rule" do
|
392
|
+
expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
393
393
|
end
|
394
394
|
end
|
395
395
|
|
396
|
-
describe ".
|
396
|
+
describe ".edit_push_rule" do
|
397
397
|
before do
|
398
|
-
stub_put("/projects/1/
|
399
|
-
@
|
398
|
+
stub_put("/projects/1/push_rule", "push_rule")
|
399
|
+
@push_rule = Gitlab.edit_push_rule(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" })
|
400
400
|
end
|
401
401
|
|
402
402
|
it "should get the correct resource" do
|
403
|
-
expect(a_put("/projects/1/
|
403
|
+
expect(a_put("/projects/1/push_rule")).to have_been_made
|
404
404
|
end
|
405
405
|
|
406
|
-
it "should return information about an edited
|
407
|
-
expect(@
|
406
|
+
it "should return information about an edited push rule" do
|
407
|
+
expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
408
408
|
end
|
409
409
|
end
|
410
410
|
|
411
|
-
describe ".
|
411
|
+
describe ".delete_push_rule" do
|
412
412
|
context "when empty response" do
|
413
413
|
before do
|
414
|
-
stub_request(:delete, "#{Gitlab.endpoint}/projects/1/
|
414
|
+
stub_request(:delete, "#{Gitlab.endpoint}/projects/1/push_rule").
|
415
415
|
with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
|
416
416
|
to_return(body: '')
|
417
|
-
@
|
417
|
+
@push_rule = Gitlab.delete_push_rule(1)
|
418
418
|
end
|
419
419
|
|
420
420
|
it "should get the correct resource" do
|
421
|
-
expect(a_delete("/projects/1/
|
421
|
+
expect(a_delete("/projects/1/push_rule")).to have_been_made
|
422
422
|
end
|
423
423
|
|
424
424
|
it "should return false" do
|
425
|
-
expect(@
|
425
|
+
expect(@push_rule).to be(false)
|
426
426
|
end
|
427
427
|
end
|
428
428
|
|
429
429
|
context "when JSON response" do
|
430
430
|
before do
|
431
|
-
stub_delete("/projects/1/
|
432
|
-
@
|
431
|
+
stub_delete("/projects/1/push_rule", "push_rule")
|
432
|
+
@push_rule = Gitlab.delete_push_rule(1)
|
433
433
|
end
|
434
434
|
|
435
435
|
it "should get the correct resource" do
|
436
|
-
expect(a_delete("/projects/1/
|
436
|
+
expect(a_delete("/projects/1/push_rule")).to have_been_made
|
437
437
|
end
|
438
438
|
|
439
|
-
it "should return information about a deleted
|
440
|
-
expect(@
|
439
|
+
it "should return information about a deleted push rule" do
|
440
|
+
expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
441
441
|
end
|
442
442
|
end
|
443
443
|
end
|
@@ -475,12 +475,12 @@ describe Gitlab::Client do
|
|
475
475
|
|
476
476
|
describe ".deploy_keys" do
|
477
477
|
before do
|
478
|
-
stub_get("/projects/42/
|
478
|
+
stub_get("/projects/42/deploy_keys", "project_keys")
|
479
479
|
@deploy_keys = Gitlab.deploy_keys(42)
|
480
480
|
end
|
481
481
|
|
482
482
|
it "should get the correct resource" do
|
483
|
-
expect(a_get("/projects/42/
|
483
|
+
expect(a_get("/projects/42/deploy_keys")).to have_been_made
|
484
484
|
end
|
485
485
|
|
486
486
|
it "should return project deploy keys" do
|
@@ -493,12 +493,12 @@ describe Gitlab::Client do
|
|
493
493
|
|
494
494
|
describe ".deploy_key" do
|
495
495
|
before do
|
496
|
-
stub_get("/projects/42/
|
496
|
+
stub_get("/projects/42/deploy_keys/2", "project_key")
|
497
497
|
@deploy_key = Gitlab.deploy_key(42, 2)
|
498
498
|
end
|
499
499
|
|
500
500
|
it "should get the correct resource" do
|
501
|
-
expect(a_get("/projects/42/
|
501
|
+
expect(a_get("/projects/42/deploy_keys/2")).to have_been_made
|
502
502
|
end
|
503
503
|
|
504
504
|
it "should return project deploy key" do
|
@@ -510,16 +510,94 @@ describe Gitlab::Client do
|
|
510
510
|
|
511
511
|
describe ".delete_deploy_key" do
|
512
512
|
before do
|
513
|
-
stub_delete("/projects/42/
|
513
|
+
stub_delete("/projects/42/deploy_keys/2", "project_key")
|
514
514
|
@deploy_key = Gitlab.delete_deploy_key(42, 2)
|
515
515
|
end
|
516
516
|
|
517
517
|
it "should get the correct resource" do
|
518
|
-
expect(a_delete("/projects/42/
|
518
|
+
expect(a_delete("/projects/42/deploy_keys/2")).to have_been_made
|
519
519
|
end
|
520
520
|
|
521
521
|
it "should return information about a deleted key" do
|
522
522
|
expect(@deploy_key.id).to eq(2)
|
523
523
|
end
|
524
524
|
end
|
525
|
+
|
526
|
+
describe ".enable_deploy_key" do
|
527
|
+
before do
|
528
|
+
stub_post("/projects/42/deploy_keys/2/enable", "project_key")
|
529
|
+
@deploy_key = Gitlab.enable_deploy_key(42, 2)
|
530
|
+
end
|
531
|
+
|
532
|
+
it "should get the correct resource" do
|
533
|
+
expect(a_post("/projects/42/deploy_keys/2/enable").
|
534
|
+
with(body: { id: '42', key_id: '2' })).to have_been_made
|
535
|
+
end
|
536
|
+
|
537
|
+
it "should return information about an enabled key" do
|
538
|
+
expect(@deploy_key.id).to eq(2)
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
describe ".disable_deploy_key" do
|
543
|
+
before do
|
544
|
+
stub_post("/projects/42/deploy_keys/2/disable", "project_key")
|
545
|
+
@deploy_key = Gitlab.disable_deploy_key(42, 2)
|
546
|
+
end
|
547
|
+
|
548
|
+
it "should get the correct resource" do
|
549
|
+
expect(a_post("/projects/42/deploy_keys/2/disable").
|
550
|
+
with(body: { id: '42', key_id: '2' })).to have_been_made
|
551
|
+
end
|
552
|
+
|
553
|
+
it "should return information about a disabled key" do
|
554
|
+
expect(@deploy_key.id).to eq(2)
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
describe ".share_project_with_group" do
|
559
|
+
before do
|
560
|
+
stub_post("/projects/3/share", "group")
|
561
|
+
@group = Gitlab.share_project_with_group(3, 10, 40)
|
562
|
+
end
|
563
|
+
|
564
|
+
it "should get the correct resource" do
|
565
|
+
expect(a_post("/projects/3/share").
|
566
|
+
with(body: { group_id: '10', group_access: '40' })).to have_been_made
|
567
|
+
end
|
568
|
+
|
569
|
+
it "should return information about an added group" do
|
570
|
+
expect(@group.id).to eq(10)
|
571
|
+
end
|
572
|
+
end
|
573
|
+
|
574
|
+
describe ".star_project" do
|
575
|
+
before do
|
576
|
+
stub_post("/projects/3/star", "project_star")
|
577
|
+
@starred_project = Gitlab.star_project(3)
|
578
|
+
end
|
579
|
+
|
580
|
+
it "should get the correct resource" do
|
581
|
+
expect(a_post("/projects/3/star")).to have_been_made
|
582
|
+
end
|
583
|
+
|
584
|
+
it "should return information about the starred project" do
|
585
|
+
expect(@starred_project.id).to eq(3)
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
describe ".unstar_project" do
|
590
|
+
before do
|
591
|
+
stub_delete("/projects/3/star", "project_unstar")
|
592
|
+
@unstarred_project = Gitlab.unstar_project(3)
|
593
|
+
end
|
594
|
+
|
595
|
+
it "should get the correct resource" do
|
596
|
+
expect(a_delete("/projects/3/star")).to have_been_made
|
597
|
+
end
|
598
|
+
|
599
|
+
it "should return information about the unstarred project" do
|
600
|
+
expect(@unstarred_project.id).to eq(3)
|
601
|
+
end
|
602
|
+
end
|
525
603
|
end
|