gitlab 3.6.1 → 3.7.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.
- data/.travis.yml +2 -0
- data/CHANGELOG.md +25 -0
- data/README.md +9 -2
- data/gitlab.gemspec +5 -1
- data/lib/gitlab.rb +3 -2
- data/lib/gitlab/cli_helpers.rb +8 -3
- data/lib/gitlab/client.rb +6 -0
- data/lib/gitlab/client/build_triggers.rb +51 -0
- data/lib/gitlab/client/build_variables.rb +66 -0
- data/lib/gitlab/client/builds.rb +106 -0
- data/lib/gitlab/client/commits.rb +5 -5
- data/lib/gitlab/client/groups.rb +36 -3
- data/lib/gitlab/client/issues.rb +16 -3
- data/lib/gitlab/client/labels.rb +2 -2
- data/lib/gitlab/client/merge_requests.rb +49 -8
- data/lib/gitlab/client/milestones.rb +1 -1
- data/lib/gitlab/client/notes.rb +28 -1
- data/lib/gitlab/client/projects.rb +60 -7
- data/lib/gitlab/client/repositories.rb +1 -32
- data/lib/gitlab/client/runners.rb +115 -0
- data/lib/gitlab/client/services.rb +48 -0
- data/lib/gitlab/client/snippets.rb +2 -2
- data/lib/gitlab/client/tags.rb +96 -0
- data/lib/gitlab/client/users.rb +72 -2
- data/lib/gitlab/error.rb +53 -10
- data/lib/gitlab/file_response.rb +45 -0
- data/lib/gitlab/help.rb +1 -0
- data/lib/gitlab/objectified_hash.rb +1 -1
- data/lib/gitlab/paginated_response.rb +2 -2
- data/lib/gitlab/request.rb +13 -34
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/build.json +38 -0
- data/spec/fixtures/build_artifacts.json +0 -0
- data/spec/fixtures/build_cancel.json +24 -0
- data/spec/fixtures/build_erase.json +24 -0
- data/spec/fixtures/build_retry.json +24 -0
- data/spec/fixtures/builds.json +78 -0
- data/spec/fixtures/builds_commits.json +64 -0
- data/spec/fixtures/error_project_not_found.json +1 -0
- data/spec/fixtures/git_hook.json +1 -0
- data/spec/fixtures/group_delete.json +1 -0
- data/spec/fixtures/group_member_edit.json +1 -0
- data/spec/fixtures/group_projects.json +44 -0
- data/spec/fixtures/merge_request_commits.json +1 -0
- data/spec/fixtures/project_runner_enable.json +7 -0
- data/spec/fixtures/project_runners.json +16 -0
- data/spec/fixtures/release_create.json +1 -0
- data/spec/fixtures/release_update.json +1 -0
- data/spec/fixtures/runner.json +26 -0
- data/spec/fixtures/runner_delete.json +7 -0
- data/spec/fixtures/runner_edit.json +26 -0
- data/spec/fixtures/runners.json +16 -0
- data/spec/fixtures/runners_all.json +30 -0
- data/spec/fixtures/service.json +1 -0
- data/spec/fixtures/tag.json +1 -0
- data/spec/fixtures/tag_create.json +1 -0
- data/spec/fixtures/tag_create_with_description.json +1 -0
- data/spec/fixtures/tag_delete.json +1 -0
- data/spec/fixtures/tags.json +1 -0
- data/spec/fixtures/trigger.json +7 -0
- data/spec/fixtures/triggers.json +16 -0
- data/spec/fixtures/user_email.json +1 -0
- data/spec/fixtures/user_emails.json +1 -0
- data/spec/fixtures/user_search.json +1 -0
- data/spec/fixtures/variable.json +4 -0
- data/spec/fixtures/variables.json +10 -0
- data/spec/gitlab/client/build_triggers_spec.rb +67 -0
- data/spec/gitlab/client/build_variables_spec.rb +86 -0
- data/spec/gitlab/client/builds_spec.rb +148 -0
- data/spec/gitlab/client/groups_spec.rb +51 -0
- data/spec/gitlab/client/issues_spec.rb +16 -0
- data/spec/gitlab/client/merge_requests_spec.rb +27 -4
- data/spec/gitlab/client/notes_spec.rb +32 -0
- data/spec/gitlab/client/projects_spec.rb +79 -0
- data/spec/gitlab/client/runners_spec.rb +185 -0
- data/spec/gitlab/client/services_spec.rb +55 -0
- data/spec/gitlab/client/tags_spec.rb +109 -0
- data/spec/gitlab/client/users_spec.rb +136 -0
- data/spec/gitlab/error_spec.rb +45 -0
- data/spec/gitlab/file_response_spec.rb +28 -0
- data/spec/gitlab/help_spec.rb +6 -1
- data/spec/gitlab/request_spec.rb +0 -27
- data/spec/gitlab/shell_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +131 -23
- checksums.yaml +0 -7
@@ -98,12 +98,12 @@ describe Gitlab::Client do
|
|
98
98
|
|
99
99
|
describe ".merge_request_comments" do
|
100
100
|
before do
|
101
|
-
stub_get("/projects/3/
|
101
|
+
stub_get("/projects/3/merge_requests/2/notes", "merge_request_comments")
|
102
102
|
@merge_request = Gitlab.merge_request_comments(3, 2)
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should get the correct resource" do
|
106
|
-
expect(a_get("/projects/3/
|
106
|
+
expect(a_get("/projects/3/merge_requests/2/notes")).to have_been_made
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should return merge request's comments" do
|
@@ -118,12 +118,12 @@ describe Gitlab::Client do
|
|
118
118
|
|
119
119
|
describe ".create_merge_request_comment" do
|
120
120
|
before do
|
121
|
-
stub_post("/projects/3/
|
121
|
+
stub_post("/projects/3/merge_requests/2/notes", "merge_request_comment")
|
122
122
|
@merge_request = Gitlab.create_merge_request_comment(3, 2, 'Cool Merge Request!')
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should get the correct resource" do
|
126
|
-
expect(a_post("/projects/3/
|
126
|
+
expect(a_post("/projects/3/merge_requests/2/notes")).to have_been_made
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should return information about a merge request" do
|
@@ -151,4 +151,27 @@ describe Gitlab::Client do
|
|
151
151
|
expect(@mr_changes.target_branch).to eq('master')
|
152
152
|
end
|
153
153
|
end
|
154
|
+
|
155
|
+
describe ".merge_request_commits" do
|
156
|
+
before do
|
157
|
+
stub_get("/projects/3/merge_request/2/commits", "merge_request_commits")
|
158
|
+
@mr_commits = Gitlab.merge_request_commits(3, 2)
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should get the correct resource" do
|
162
|
+
expect(a_get("/projects/3/merge_request/2/commits")).to have_been_made
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should return the merge request commits" do
|
166
|
+
expect(@mr_commits).to be_a Gitlab::PaginatedResponse
|
167
|
+
expect(@mr_commits.size).to eq 2
|
168
|
+
expect(@mr_commits.first.id).to eq "a2da7552f26d5b46a6a09bb8b7b066e3a102be7d"
|
169
|
+
expect(@mr_commits.first.short_id).to eq "a2da7552"
|
170
|
+
expect(@mr_commits.first.title).to eq "piyo"
|
171
|
+
expect(@mr_commits.first.author_name).to eq "example"
|
172
|
+
expect(@mr_commits.first.author_email).to eq "example@example.com"
|
173
|
+
expect(@mr_commits[1].short_id).to eq "3ce50959"
|
174
|
+
expect(@mr_commits[1].title).to eq "hoge"
|
175
|
+
end
|
176
|
+
end
|
154
177
|
end
|
@@ -49,6 +49,22 @@ describe Gitlab::Client do
|
|
49
49
|
expect(@notes.first.author.name).to eq("John Smith")
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
context "when merge_request notes" do
|
54
|
+
before do
|
55
|
+
stub_get("/projects/3/merge_requests/7/notes", "notes")
|
56
|
+
@notes = Gitlab.merge_request_notes(3, 7)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should get the correct resource" do
|
60
|
+
expect(a_get("/projects/3/merge_requests/7/notes")).to have_been_made
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should return a paginated response of notes" do
|
64
|
+
expect(@notes).to be_a Gitlab::PaginatedResponse
|
65
|
+
expect(@notes.first.author.name).to eq("John Smith")
|
66
|
+
end
|
67
|
+
end
|
52
68
|
end
|
53
69
|
|
54
70
|
describe "note" do
|
@@ -99,6 +115,22 @@ describe Gitlab::Client do
|
|
99
115
|
expect(@note.author.name).to eq("John Smith")
|
100
116
|
end
|
101
117
|
end
|
118
|
+
|
119
|
+
context "when merge request note" do
|
120
|
+
before do
|
121
|
+
stub_get("/projects/3/merge_requests/7/notes/1201", "note")
|
122
|
+
@note = Gitlab.merge_request_note(3, 7, 1201)
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should get the correct resource" do
|
126
|
+
expect(a_get("/projects/3/merge_requests/7/notes/1201")).to have_been_made
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should return information about a note" do
|
130
|
+
expect(@note.body).to eq("The solution is rather tricky")
|
131
|
+
expect(@note.author.name).to eq("John Smith")
|
132
|
+
end
|
133
|
+
end
|
102
134
|
end
|
103
135
|
|
104
136
|
describe "create note" do
|
@@ -363,6 +363,85 @@ describe Gitlab::Client do
|
|
363
363
|
end
|
364
364
|
end
|
365
365
|
|
366
|
+
describe ".git_hook" do
|
367
|
+
before do
|
368
|
+
stub_get("/projects/1/git_hook", "git_hook")
|
369
|
+
@git_hook = Gitlab.git_hook(1)
|
370
|
+
end
|
371
|
+
|
372
|
+
it "should get the correct resource" do
|
373
|
+
expect(a_get("/projects/1/git_hook")).to have_been_made
|
374
|
+
end
|
375
|
+
|
376
|
+
it "should return information about a git hook" do
|
377
|
+
expect(@git_hook.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
describe ".add_git_hook" do
|
382
|
+
before do
|
383
|
+
stub_post("/projects/1/git_hook", "git_hook")
|
384
|
+
@git_hook = Gitlab.add_git_hook(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" })
|
385
|
+
end
|
386
|
+
|
387
|
+
it "should get the correct resource" do
|
388
|
+
expect(a_post("/projects/1/git_hook")).to have_been_made
|
389
|
+
end
|
390
|
+
|
391
|
+
it "should return information about an added git hook" do
|
392
|
+
expect(@git_hook.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
describe ".edit_git_hook" do
|
397
|
+
before do
|
398
|
+
stub_put("/projects/1/git_hook", "git_hook")
|
399
|
+
@git_hook = Gitlab.edit_git_hook(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" })
|
400
|
+
end
|
401
|
+
|
402
|
+
it "should get the correct resource" do
|
403
|
+
expect(a_put("/projects/1/git_hook")).to have_been_made
|
404
|
+
end
|
405
|
+
|
406
|
+
it "should return information about an edited git hook" do
|
407
|
+
expect(@git_hook.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
describe ".delete_git_hook" do
|
412
|
+
context "when empty response" do
|
413
|
+
before do
|
414
|
+
stub_request(:delete, "#{Gitlab.endpoint}/projects/1/git_hook").
|
415
|
+
with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
|
416
|
+
to_return(body: '')
|
417
|
+
@git_hook = Gitlab.delete_git_hook(1)
|
418
|
+
end
|
419
|
+
|
420
|
+
it "should get the correct resource" do
|
421
|
+
expect(a_delete("/projects/1/git_hook")).to have_been_made
|
422
|
+
end
|
423
|
+
|
424
|
+
it "should return false" do
|
425
|
+
expect(@git_hook).to be(false)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
context "when JSON response" do
|
430
|
+
before do
|
431
|
+
stub_delete("/projects/1/git_hook", "git_hook")
|
432
|
+
@git_hook = Gitlab.delete_git_hook(1)
|
433
|
+
end
|
434
|
+
|
435
|
+
it "should get the correct resource" do
|
436
|
+
expect(a_delete("/projects/1/git_hook")).to have_been_made
|
437
|
+
end
|
438
|
+
|
439
|
+
it "should return information about a deleted git hook" do
|
440
|
+
expect(@git_hook.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
366
445
|
describe ".make_forked_from" do
|
367
446
|
before do
|
368
447
|
stub_post("/projects/42/fork/24", "project_fork_link")
|
@@ -0,0 +1,185 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gitlab::Client do
|
4
|
+
|
5
|
+
describe ".runners" do
|
6
|
+
before do
|
7
|
+
stub_get("/runners", "runners")
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'without scope' do
|
11
|
+
before do
|
12
|
+
@runner = Gitlab.runners
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should get the correct resource" do
|
16
|
+
expect(a_get("/runners")).to have_been_made
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should return a paginated response of runners" do
|
20
|
+
expect(@runner).to be_a Gitlab::PaginatedResponse
|
21
|
+
expect(@runner.first.id).to eq(6)
|
22
|
+
expect(@runner.first.description).to eq('test-1-20150125')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'with scope' do
|
27
|
+
before do
|
28
|
+
stub_get("/runners?scope=online", "runners")
|
29
|
+
@runner = Gitlab.runners({scope: :online})
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should get the correct resource" do
|
33
|
+
expect(a_get("/runners").with(query: { scope: :online })).to have_been_made
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return a paginated response of runners" do
|
37
|
+
expect(@runner).to be_a Gitlab::PaginatedResponse
|
38
|
+
expect(@runner.first.id).to eq(6)
|
39
|
+
expect(@runner.first.description).to eq('test-1-20150125')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
describe ".all_runners" do
|
46
|
+
before do
|
47
|
+
stub_get("/runners/all", "runners")
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'without scope' do
|
51
|
+
before do
|
52
|
+
@runner = Gitlab.all_runners
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should get the correct resource" do
|
56
|
+
expect(a_get("/runners/all")).to have_been_made
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should return a paginated response of runners" do
|
60
|
+
expect(@runner).to be_a Gitlab::PaginatedResponse
|
61
|
+
expect(@runner.first.id).to eq(6)
|
62
|
+
expect(@runner.first.description).to eq('test-1-20150125')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'with scope' do
|
67
|
+
before do
|
68
|
+
stub_get("/runners/all?scope=online", "runners")
|
69
|
+
@runner = Gitlab.all_runners({scope: :online})
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should get the correct resource" do
|
73
|
+
expect(a_get("/runners/all").with(query: { scope: :online })).to have_been_made
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should return a paginated response of runners" do
|
77
|
+
expect(@runner).to be_a Gitlab::PaginatedResponse
|
78
|
+
expect(@runner.first.id).to eq(6)
|
79
|
+
expect(@runner.first.description).to eq('test-1-20150125')
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe ".runner" do
|
85
|
+
before do
|
86
|
+
stub_get("/runners/6", "runner")
|
87
|
+
@runners = Gitlab.runner(6)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should get the correct resource" do
|
91
|
+
expect(a_get("/runners/6")).to have_been_made
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should return a response of a runner" do
|
95
|
+
expect(@runners).to be_a Gitlab::ObjectifiedHash
|
96
|
+
expect(@runners.id).to eq(6)
|
97
|
+
expect(@runners.description).to eq('test-1-20150125')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe ".update_runner" do
|
102
|
+
before do
|
103
|
+
stub_put("/runners/6", "runner_edit").with(query: { description: "abcefg" })
|
104
|
+
@runner = Gitlab.update_runner(6, description: "abcefg" )
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should get the correct resource" do
|
108
|
+
expect(a_put("/runners/6").with(query: { description: "abcefg" })).to have_been_made
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should return an updated response of a runner" do
|
112
|
+
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
113
|
+
expect(@runner.description).to eq('abcefg')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe ".delete_runner" do
|
118
|
+
before do
|
119
|
+
stub_delete("/runners/6", "runner_delete")
|
120
|
+
@runner = Gitlab.delete_runner(6)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should get the correct resource" do
|
124
|
+
expect(a_delete("/runners/6")).to have_been_made
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should return a response of the deleted runner" do
|
128
|
+
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
129
|
+
expect(@runner.id).to eq(6)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
describe ".project_runners" do
|
134
|
+
before do
|
135
|
+
stub_get("/projects/1/runners", "project_runners")
|
136
|
+
@runners = Gitlab.project_runners(1)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should get the correct resource" do
|
140
|
+
expect(a_get("/projects/1/runners")).to have_been_made
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should return a paginated response of runners" do
|
144
|
+
expect(@runners).to be_a Gitlab::PaginatedResponse
|
145
|
+
expect(@runners.first.id).to eq(8)
|
146
|
+
expect(@runners.first.description).to eq('test-2-20150125')
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe ".project_enable_runner" do
|
151
|
+
before do
|
152
|
+
stub_post("/projects/1/runners", "runner")
|
153
|
+
@runner = Gitlab.project_enable_runner(1, 6)
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should get the correct resource" do
|
157
|
+
expect(a_post("/projects/1/runners")).to have_been_made
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should return a response of the enabled runner" do
|
161
|
+
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
162
|
+
expect(@runner.id).to eq(6)
|
163
|
+
expect(@runner.description).to eq('test-1-20150125')
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe ".project_disable_runner" do
|
168
|
+
before do
|
169
|
+
stub_delete("/projects/1/runners/6", "runner")
|
170
|
+
@runner = Gitlab.project_disable_runner(1, 6)
|
171
|
+
end
|
172
|
+
|
173
|
+
it "should get the correct resource" do
|
174
|
+
expect(a_delete("/projects/1/runners/6")).to have_been_made
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should return a response of the disabled runner" do
|
178
|
+
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
179
|
+
expect(@runner.id).to eq(6)
|
180
|
+
expect(@runner.description).to eq('test-1-20150125')
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gitlab::Client do
|
4
|
+
describe ".service" do
|
5
|
+
before do
|
6
|
+
stub_get("/projects/3/services/redmine", "service")
|
7
|
+
@service = Gitlab.service(3, :redmine)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should get the correct resource" do
|
11
|
+
expect(a_get("/projects/3/services/redmine")).to have_been_made
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return a information about a service of project" do
|
15
|
+
expect(@service.id).to eq 38
|
16
|
+
expect(@service.title).to eq("Redmine")
|
17
|
+
expect(@service.properties.project_url).to eq("https://example.com/projects/test_project/issue")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe ".change_service" do
|
22
|
+
before do
|
23
|
+
stub_put("/projects/3/services/redmine", "service")
|
24
|
+
@service = Gitlab.change_service(3, :redmine, new_issue_url: 'https://example.com/projects/test_project/issues/new',
|
25
|
+
project_url: 'https://example.com/projects/test_project/issues',
|
26
|
+
issues_url: 'https://example.com/issues/:id')
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should get the correct resource" do
|
30
|
+
body = {new_issue_url: 'https://example.com/projects/test_project/issues/new',
|
31
|
+
project_url: 'https://example.com/projects/test_project/issues',
|
32
|
+
issues_url: 'https://example.com/issues/:id'}
|
33
|
+
expect(a_put("/projects/3/services/redmine").with(body: body)).to have_been_made
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return information about a new service" do
|
37
|
+
expect(@service).to be_truthy
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe ".delete_servoce" do
|
42
|
+
before do
|
43
|
+
stub_delete("/projects/3/services/redmine", "service")
|
44
|
+
@service = Gitlab.delete_service(3, :redmine)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should get the correct resource" do
|
48
|
+
expect(a_delete("/projects/3/services/redmine")).to have_been_made
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should return information about a deleted service" do
|
52
|
+
expect(@service).to be_truthy
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gitlab::Client do
|
4
|
+
it { should respond_to :repo_tags }
|
5
|
+
it { should respond_to :repo_tag }
|
6
|
+
it { should respond_to :repo_create_tag }
|
7
|
+
it { should respond_to :repo_delete_tag }
|
8
|
+
it { should respond_to :repo_create_release }
|
9
|
+
it { should respond_to :repo_update_release }
|
10
|
+
|
11
|
+
describe '.tags' do
|
12
|
+
before do
|
13
|
+
stub_get("/projects/3/repository/tags", "tags")
|
14
|
+
@tags = Gitlab.tags(3)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should get the correct resource" do
|
18
|
+
expect(a_get("/projects/3/repository/tags")).to have_been_made
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return a paginated response of repository tags" do
|
22
|
+
expect(@tags).to be_a Gitlab::PaginatedResponse
|
23
|
+
expect(@tags.map(&:name)).to eq(%w[0.0.2 0.0.1])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe ".tag" do
|
28
|
+
before do
|
29
|
+
stub_get("/projects/3/repository/tags/0.0.1", "tag")
|
30
|
+
@tag = Gitlab.tag(3, "0.0.1")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should get the correct resource" do
|
34
|
+
expect(a_get("/projects/3/repository/tags/0.0.1")).to have_been_made
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should return information about a repository tag" do
|
38
|
+
expect(@tag.name).to eq("0.0.1")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe ".create_tag" do
|
43
|
+
before do
|
44
|
+
stub_post("/projects/3/repository/tags", "tag_create")
|
45
|
+
@tag = Gitlab.create_tag(3, "0.0.1", "master", 'this tag is annotated', 'and it has release notes')
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should get the correct resource" do
|
49
|
+
expect(a_post("/projects/3/repository/tags")).to have_been_made
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return information about a new repository tag" do
|
53
|
+
expect(@tag.name).to eq("0.0.1")
|
54
|
+
expect(@tag.message).to eq('this tag is annotated')
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return detailed information" do
|
58
|
+
expect(@tag.release.description).to eq('and it has release notes')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe ".delete_tag" do
|
63
|
+
before do
|
64
|
+
stub_delete("/projects/3/repository/tags/0.0.1", "tag_delete")
|
65
|
+
@tag = Gitlab.delete_tag(3, "0.0.1")
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should get the correct resource" do
|
69
|
+
expect(a_delete("/projects/3/repository/tags/0.0.1")).to have_been_made
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should return information about the deleted repository tag" do
|
73
|
+
expect(@tag.tag_name).to eq("0.0.1")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe ".create_release" do
|
78
|
+
before do
|
79
|
+
stub_post("/projects/3/repository/tags/0.0.1/release", "release_create")
|
80
|
+
@tag = Gitlab.create_release(3, "0.0.1", "Amazing release. Wow")
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should get the correct resource" do
|
84
|
+
expect(a_post("/projects/3/repository/tags/0.0.1/release")).to have_been_made
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should return information about the tag and the release" do
|
88
|
+
expect(@tag.tag_name).to eq("0.0.1")
|
89
|
+
expect(@tag.description).to eq("Amazing release. Wow")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe ".update_release" do
|
94
|
+
before do
|
95
|
+
stub_put("/projects/3/repository/tags/0.0.1/release", "release_update")
|
96
|
+
@tag = Gitlab.update_release(3, "0.0.1", 'Amazing release. Wow')
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should update the correct resource" do
|
100
|
+
expect(a_put("/projects/3/repository/tags/0.0.1/release")).to have_been_made
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should return information about the tag" do
|
104
|
+
expect(@tag.tag_name).to eq("0.0.1")
|
105
|
+
expect(@tag.description).to eq('Amazing release. Wow')
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|