gitlab 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +17 -0
- data/Rakefile +1 -1
- data/exe/gitlab +1 -1
- data/lib/gitlab.rb +5 -3
- data/lib/gitlab/cli.rb +1 -1
- data/lib/gitlab/cli_helpers.rb +24 -26
- data/lib/gitlab/client.rb +1 -1
- data/lib/gitlab/client/branches.rb +2 -5
- data/lib/gitlab/client/commits.rb +5 -5
- data/lib/gitlab/client/groups.rb +8 -9
- data/lib/gitlab/client/issues.rb +7 -7
- data/lib/gitlab/client/labels.rb +3 -3
- data/lib/gitlab/client/merge_requests.rb +7 -7
- data/lib/gitlab/client/milestones.rb +5 -5
- data/lib/gitlab/client/namespaces.rb +1 -1
- data/lib/gitlab/client/notes.rb +7 -7
- data/lib/gitlab/client/projects.rb +22 -21
- data/lib/gitlab/client/repositories.rb +7 -7
- data/lib/gitlab/client/repository_files.rb +10 -10
- data/lib/gitlab/client/snippets.rb +6 -6
- data/lib/gitlab/client/system_hooks.rb +1 -1
- data/lib/gitlab/client/users.rb +5 -6
- data/lib/gitlab/configuration.rb +1 -1
- data/lib/gitlab/help.rb +19 -15
- data/lib/gitlab/objectified_hash.rb +2 -2
- data/lib/gitlab/page_links.rb +33 -0
- data/lib/gitlab/paginated_response.rb +97 -0
- data/lib/gitlab/request.rb +24 -26
- data/lib/gitlab/shell.rb +4 -5
- data/lib/gitlab/shell_history.rb +3 -5
- data/lib/gitlab/version.rb +1 -1
- data/spec/gitlab/cli_helpers_spec.rb +8 -9
- data/spec/gitlab/cli_spec.rb +0 -2
- data/spec/gitlab/client/branches_spec.rb +2 -2
- data/spec/gitlab/client/commits_spec.rb +16 -16
- data/spec/gitlab/client/groups_spec.rb +11 -14
- data/spec/gitlab/client/issues_spec.rb +9 -9
- data/spec/gitlab/client/labels_spec.rb +6 -6
- data/spec/gitlab/client/merge_requests_spec.rb +23 -23
- data/spec/gitlab/client/milestones_spec.rb +9 -9
- data/spec/gitlab/client/namespaces_spec.rb +2 -2
- data/spec/gitlab/client/notes_spec.rb +10 -10
- data/spec/gitlab/client/projects_spec.rb +29 -28
- data/spec/gitlab/client/repositories_spec.rb +7 -7
- data/spec/gitlab/client/snippets_spec.rb +7 -7
- data/spec/gitlab/client/system_hooks_spec.rb +2 -2
- data/spec/gitlab/client/users_spec.rb +20 -21
- data/spec/gitlab/help_spec.rb +1 -4
- data/spec/gitlab/objectified_hash_spec.rb +2 -2
- data/spec/gitlab/page_links_spec.rb +16 -0
- data/spec/gitlab/paginated_response_spec.rb +60 -0
- data/spec/gitlab/request_spec.rb +12 -13
- data/spec/gitlab/shell_history_spec.rb +1 -1
- data/spec/gitlab/shell_spec.rb +6 -6
- data/spec/spec_helper.rb +12 -12
- metadata +8 -2
@@ -13,8 +13,8 @@ describe Gitlab::Client do
|
|
13
13
|
expect(a_get("/namespaces")).to have_been_made
|
14
14
|
end
|
15
15
|
|
16
|
-
it "should return
|
17
|
-
expect(@namespaces).to
|
16
|
+
it "should return a paginated response of namespaces" do
|
17
|
+
expect(@namespaces).to be_a Gitlab::PaginatedResponse
|
18
18
|
expect(@namespaces.first.path).to eq("john")
|
19
19
|
expect(@namespaces.first.kind).to eq("user")
|
20
20
|
end
|
@@ -12,8 +12,8 @@ describe Gitlab::Client do
|
|
12
12
|
expect(a_get("/projects/3/notes")).to have_been_made
|
13
13
|
end
|
14
14
|
|
15
|
-
it "should return
|
16
|
-
expect(@notes).to
|
15
|
+
it "should return a paginated response of notes" do
|
16
|
+
expect(@notes).to be_a Gitlab::PaginatedResponse
|
17
17
|
expect(@notes.first.author.name).to eq("John Smith")
|
18
18
|
end
|
19
19
|
end
|
@@ -28,8 +28,8 @@ describe Gitlab::Client do
|
|
28
28
|
expect(a_get("/projects/3/issues/7/notes")).to have_been_made
|
29
29
|
end
|
30
30
|
|
31
|
-
it "should return
|
32
|
-
expect(@notes).to
|
31
|
+
it "should return a paginated response of notes" do
|
32
|
+
expect(@notes).to be_a Gitlab::PaginatedResponse
|
33
33
|
expect(@notes.first.author.name).to eq("John Smith")
|
34
34
|
end
|
35
35
|
end
|
@@ -44,8 +44,8 @@ describe Gitlab::Client do
|
|
44
44
|
expect(a_get("/projects/3/snippets/7/notes")).to have_been_made
|
45
45
|
end
|
46
46
|
|
47
|
-
it "should return
|
48
|
-
expect(@notes).to
|
47
|
+
it "should return a paginated response of notes" do
|
48
|
+
expect(@notes).to be_a Gitlab::PaginatedResponse
|
49
49
|
expect(@notes.first.author.name).to eq("John Smith")
|
50
50
|
end
|
51
51
|
end
|
@@ -110,7 +110,7 @@ describe Gitlab::Client do
|
|
110
110
|
|
111
111
|
it "should get the correct resource" do
|
112
112
|
expect(a_post("/projects/3/notes").
|
113
|
-
with(:
|
113
|
+
with(body: { body: 'The solution is rather tricky' })).to have_been_made
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should return information about a created note" do
|
@@ -127,7 +127,7 @@ describe Gitlab::Client do
|
|
127
127
|
|
128
128
|
it "should get the correct resource" do
|
129
129
|
expect(a_post("/projects/3/issues/7/notes").
|
130
|
-
with(:
|
130
|
+
with(body: { body: 'The solution is rather tricky' })).to have_been_made
|
131
131
|
end
|
132
132
|
|
133
133
|
it "should return information about a created note" do
|
@@ -144,7 +144,7 @@ describe Gitlab::Client do
|
|
144
144
|
|
145
145
|
it "should get the correct resource" do
|
146
146
|
expect(a_post("/projects/3/snippets/7/notes").
|
147
|
-
with(:
|
147
|
+
with(body: { body: 'The solution is rather tricky' })).to have_been_made
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should return information about a created note" do
|
@@ -161,7 +161,7 @@ describe Gitlab::Client do
|
|
161
161
|
|
162
162
|
it "should get the correct resource" do
|
163
163
|
expect(a_post("/projects/3/merge_requests/7/notes").
|
164
|
-
with(:
|
164
|
+
with(body: { body: 'The solution is rather tricky' })).to have_been_made
|
165
165
|
end
|
166
166
|
|
167
167
|
it "should return information about a created note" do
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Gitlab::Client do
|
4
|
+
it { should respond_to :search_projects }
|
5
|
+
|
4
6
|
describe ".projects" do
|
5
7
|
before do
|
6
8
|
stub_get("/projects", "projects")
|
@@ -11,8 +13,8 @@ describe Gitlab::Client do
|
|
11
13
|
expect(a_get("/projects")).to have_been_made
|
12
14
|
end
|
13
15
|
|
14
|
-
it "should return
|
15
|
-
expect(@projects).to
|
16
|
+
it "should return a paginated response of projects" do
|
17
|
+
expect(@projects).to be_a Gitlab::PaginatedResponse
|
16
18
|
expect(@projects.first.name).to eq("Brute")
|
17
19
|
expect(@projects.first.owner.name).to eq("John Smith")
|
18
20
|
end
|
@@ -28,12 +30,11 @@ describe Gitlab::Client do
|
|
28
30
|
expect(a_get("/projects/search/Gitlab")).to have_been_made
|
29
31
|
end
|
30
32
|
|
31
|
-
it "should return
|
32
|
-
expect(@project_search).to
|
33
|
+
it "should return a paginated response of projects found" do
|
34
|
+
expect(@project_search).to be_a Gitlab::PaginatedResponse
|
33
35
|
expect(@project_search.first.name).to eq("Gitlab")
|
34
36
|
expect(@project_search.first.owner.name).to eq("John Smith")
|
35
37
|
end
|
36
|
-
|
37
38
|
end
|
38
39
|
|
39
40
|
describe ".project" do
|
@@ -62,8 +63,8 @@ describe Gitlab::Client do
|
|
62
63
|
expect(a_get("/projects/2/events")).to have_been_made
|
63
64
|
end
|
64
65
|
|
65
|
-
it "should return
|
66
|
-
expect(@events).to
|
66
|
+
it "should return a paginated response of events" do
|
67
|
+
expect(@events).to be_a Gitlab::PaginatedResponse
|
67
68
|
expect(@events.size).to eq(2)
|
68
69
|
end
|
69
70
|
|
@@ -91,9 +92,9 @@ describe Gitlab::Client do
|
|
91
92
|
describe ".create_project for user" do
|
92
93
|
before do
|
93
94
|
stub_post("/users", "user")
|
94
|
-
@owner = Gitlab.create_user("john@example.com", "pass",
|
95
|
+
@owner = Gitlab.create_user("john@example.com", "pass", name: 'John Owner')
|
95
96
|
stub_post("/projects/user/#{@owner.id}", "project_for_user")
|
96
|
-
@project = Gitlab.create_project('Brute',
|
97
|
+
@project = Gitlab.create_project('Brute', user_id: @owner.id)
|
97
98
|
end
|
98
99
|
|
99
100
|
it "should return information about a created project" do
|
@@ -139,7 +140,7 @@ describe Gitlab::Client do
|
|
139
140
|
before do
|
140
141
|
stub_post("/projects/fork/3", "project_forked_for_user")
|
141
142
|
@sudoed_username = 'jack.smith'
|
142
|
-
@project = Gitlab.create_fork(3,
|
143
|
+
@project = Gitlab.create_fork(3, sudo: @sudoed_username)
|
143
144
|
end
|
144
145
|
|
145
146
|
it "should post to the correct resource" do
|
@@ -164,8 +165,8 @@ describe Gitlab::Client do
|
|
164
165
|
expect(a_get("/projects/3/members")).to have_been_made
|
165
166
|
end
|
166
167
|
|
167
|
-
it "should return
|
168
|
-
expect(@team_members).to
|
168
|
+
it "should return a paginated response of team members" do
|
169
|
+
expect(@team_members).to be_a Gitlab::PaginatedResponse
|
169
170
|
expect(@team_members.first.name).to eq("John Smith")
|
170
171
|
end
|
171
172
|
end
|
@@ -193,7 +194,7 @@ describe Gitlab::Client do
|
|
193
194
|
|
194
195
|
it "should get the correct resource" do
|
195
196
|
expect(a_post("/projects/3/members").
|
196
|
-
with(:
|
197
|
+
with(body: { user_id: '1', access_level: '40' })).to have_been_made
|
197
198
|
end
|
198
199
|
|
199
200
|
it "should return information about an added team member" do
|
@@ -209,7 +210,7 @@ describe Gitlab::Client do
|
|
209
210
|
|
210
211
|
it "should get the correct resource" do
|
211
212
|
expect(a_put("/projects/3/members/1").
|
212
|
-
with(:
|
213
|
+
with(body: { access_level: '40' })).to have_been_made
|
213
214
|
end
|
214
215
|
|
215
216
|
it "should return information about an edited team member" do
|
@@ -242,8 +243,8 @@ describe Gitlab::Client do
|
|
242
243
|
expect(a_get("/projects/1/hooks")).to have_been_made
|
243
244
|
end
|
244
245
|
|
245
|
-
it "should return
|
246
|
-
expect(@hooks).to
|
246
|
+
it "should return a paginated response of hooks" do
|
247
|
+
expect(@hooks).to be_a Gitlab::PaginatedResponse
|
247
248
|
expect(@hooks.first.url).to eq("https://api.example.net/v1/webhooks/ci")
|
248
249
|
end
|
249
250
|
end
|
@@ -271,8 +272,8 @@ describe Gitlab::Client do
|
|
271
272
|
end
|
272
273
|
|
273
274
|
it "should get the correct resource" do
|
274
|
-
body = {:
|
275
|
-
expect(a_post("/projects/1/hooks").with(:
|
275
|
+
body = { url: "https://api.example.net/v1/webhooks/ci" }
|
276
|
+
expect(a_post("/projects/1/hooks").with(body: body)).to have_been_made
|
276
277
|
end
|
277
278
|
|
278
279
|
it "should return information about an added hook" do
|
@@ -287,8 +288,8 @@ describe Gitlab::Client do
|
|
287
288
|
end
|
288
289
|
|
289
290
|
it "should get the correct resource" do
|
290
|
-
body = {:
|
291
|
-
expect(a_post("/projects/1/hooks").with(:
|
291
|
+
body = { url: "https://api.example.net/v1/webhooks/ci", push_events: "true", merge_requests_events: "true" }
|
292
|
+
expect(a_post("/projects/1/hooks").with(body: body)).to have_been_made
|
292
293
|
end
|
293
294
|
|
294
295
|
it "should return information about an added hook" do
|
@@ -304,8 +305,8 @@ describe Gitlab::Client do
|
|
304
305
|
end
|
305
306
|
|
306
307
|
it "should get the correct resource" do
|
307
|
-
body = {:
|
308
|
-
expect(a_put("/projects/1/hooks/1").with(:
|
308
|
+
body = { url: "https://api.example.net/v1/webhooks/ci" }
|
309
|
+
expect(a_put("/projects/1/hooks/1").with(body: body)).to have_been_made
|
309
310
|
end
|
310
311
|
|
311
312
|
it "should return information about an edited hook" do
|
@@ -315,12 +316,12 @@ describe Gitlab::Client do
|
|
315
316
|
|
316
317
|
describe ".edit_project" do
|
317
318
|
before do
|
318
|
-
stub_put("/projects/3", "project_edit").with(:
|
319
|
-
@edited_project =
|
319
|
+
stub_put("/projects/3", "project_edit").with(query: { name: "Gitlab-edit" })
|
320
|
+
@edited_project = Gitlab.edit_project(3, name: "Gitlab-edit")
|
320
321
|
end
|
321
322
|
|
322
323
|
it "should get the correct resource" do
|
323
|
-
expect(a_put("/projects/3").with(:
|
324
|
+
expect(a_put("/projects/3").with(query: { name: "Gitlab-edit" })).to have_been_made
|
324
325
|
end
|
325
326
|
|
326
327
|
it "should return information about an edited project" do
|
@@ -332,8 +333,8 @@ describe Gitlab::Client do
|
|
332
333
|
context "when empty response" do
|
333
334
|
before do
|
334
335
|
stub_request(:delete, "#{Gitlab.endpoint}/projects/1/hooks/1").
|
335
|
-
with(:
|
336
|
-
to_return(:
|
336
|
+
with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
|
337
|
+
to_return(body: '')
|
337
338
|
@hook = Gitlab.delete_project_hook(1, 1)
|
338
339
|
end
|
339
340
|
|
@@ -404,7 +405,7 @@ describe Gitlab::Client do
|
|
404
405
|
end
|
405
406
|
|
406
407
|
it "should return project deploy keys" do
|
407
|
-
expect(@deploy_keys).to
|
408
|
+
expect(@deploy_keys).to be_a Gitlab::PaginatedResponse
|
408
409
|
expect(@deploy_keys.first.id).to eq 2
|
409
410
|
expect(@deploy_keys.first.title).to eq "Key Title"
|
410
411
|
expect(@deploy_keys.first.key).to match(/ssh-rsa/)
|
@@ -6,7 +6,7 @@ describe Gitlab::Client do
|
|
6
6
|
it { should respond_to :repo_branches }
|
7
7
|
it { should respond_to :repo_branch }
|
8
8
|
it { should respond_to :repo_tree }
|
9
|
-
it { should respond_to :repo_compare}
|
9
|
+
it { should respond_to :repo_compare }
|
10
10
|
|
11
11
|
describe ".tags" do
|
12
12
|
before do
|
@@ -18,8 +18,8 @@ describe Gitlab::Client do
|
|
18
18
|
expect(a_get("/projects/3/repository/tags")).to have_been_made
|
19
19
|
end
|
20
20
|
|
21
|
-
it "should return
|
22
|
-
expect(@tags).to
|
21
|
+
it "should return a paginated response of repository tags" do
|
22
|
+
expect(@tags).to be_a Gitlab::PaginatedResponse
|
23
23
|
expect(@tags.first.name).to eq("v2.8.2")
|
24
24
|
end
|
25
25
|
end
|
@@ -83,8 +83,8 @@ describe Gitlab::Client do
|
|
83
83
|
expect(a_get("/projects/3/repository/tree")).to have_been_made
|
84
84
|
end
|
85
85
|
|
86
|
-
it "should return
|
87
|
-
expect(@tree).to
|
86
|
+
it "should return a paginated response of repository tree files (root level)" do
|
87
|
+
expect(@tree).to be_a Gitlab::PaginatedResponse
|
88
88
|
expect(@tree.first.name).to eq("app")
|
89
89
|
end
|
90
90
|
end
|
@@ -92,13 +92,13 @@ describe Gitlab::Client do
|
|
92
92
|
describe ".compare" do
|
93
93
|
before do
|
94
94
|
stub_get("/projects/3/repository/compare", "compare_merge_request_diff").
|
95
|
-
with(:
|
95
|
+
with(query: { from: "master", to: "feature" })
|
96
96
|
@diff = Gitlab.compare(3, 'master', 'feature')
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should get the correct resource" do
|
100
100
|
expect(a_get("/projects/3/repository/compare").
|
101
|
-
with(:
|
101
|
+
with(query: { from: "master", to: "feature" })).to have_been_made
|
102
102
|
end
|
103
103
|
|
104
104
|
it "should get diffs of a merge request" do
|
@@ -11,8 +11,8 @@ describe Gitlab::Client do
|
|
11
11
|
expect(a_get("/projects/3/snippets")).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
-
it "should return
|
15
|
-
expect(@snippets).to
|
14
|
+
it "should return a paginated response of project's snippets" do
|
15
|
+
expect(@snippets).to be_a Gitlab::PaginatedResponse
|
16
16
|
expect(@snippets.first.file_name).to eq("mailer_test.rb")
|
17
17
|
end
|
18
18
|
end
|
@@ -36,12 +36,12 @@ describe Gitlab::Client do
|
|
36
36
|
describe ".create_snippet" do
|
37
37
|
before do
|
38
38
|
stub_post("/projects/3/snippets", "snippet")
|
39
|
-
@snippet = Gitlab.create_snippet(3,
|
39
|
+
@snippet = Gitlab.create_snippet(3, title: 'API', file_name: 'api.rb', code: 'code')
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should get the correct resource" do
|
43
|
-
body = {:
|
44
|
-
expect(a_post("/projects/3/snippets").with(:
|
43
|
+
body = { title: 'API', file_name: 'api.rb', code: 'code' }
|
44
|
+
expect(a_post("/projects/3/snippets").with(body: body)).to have_been_made
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should return information about a new snippet" do
|
@@ -53,12 +53,12 @@ describe Gitlab::Client do
|
|
53
53
|
describe ".edit_snippet" do
|
54
54
|
before do
|
55
55
|
stub_put("/projects/3/snippets/1", "snippet")
|
56
|
-
@snippet = Gitlab.edit_snippet(3, 1, :
|
56
|
+
@snippet = Gitlab.edit_snippet(3, 1, file_name: 'mailer_test.rb')
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should get the correct resource" do
|
60
60
|
expect(a_put("/projects/3/snippets/1").
|
61
|
-
with(:
|
61
|
+
with(body: { file_name: 'mailer_test.rb' })).to have_been_made
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should return information about an edited snippet" do
|
@@ -16,8 +16,8 @@ describe Gitlab::Client do
|
|
16
16
|
expect(a_get("/hooks")).to have_been_made
|
17
17
|
end
|
18
18
|
|
19
|
-
it "should return
|
20
|
-
expect(@hooks).to
|
19
|
+
it "should return a paginated response of system hooks" do
|
20
|
+
expect(@hooks).to be_a Gitlab::PaginatedResponse
|
21
21
|
expect(@hooks.first.url).to eq("http://example.com/hook")
|
22
22
|
end
|
23
23
|
end
|
@@ -11,8 +11,8 @@ describe Gitlab::Client do
|
|
11
11
|
expect(a_get("/users")).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
-
it "should return
|
15
|
-
expect(@users).to
|
14
|
+
it "should return a paginated response of users" do
|
15
|
+
expect(@users).to be_a Gitlab::PaginatedResponse
|
16
16
|
expect(@users.first.email).to eq("john@example.com")
|
17
17
|
end
|
18
18
|
end
|
@@ -57,8 +57,8 @@ describe Gitlab::Client do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should get the correct resource" do
|
60
|
-
body = {:
|
61
|
-
expect(a_post("/users").with(:
|
60
|
+
body = { email: "email", password: "pass", name: "email" }
|
61
|
+
expect(a_post("/users").with(body: body)).to have_been_made
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should return information about a created user" do
|
@@ -69,9 +69,9 @@ describe Gitlab::Client do
|
|
69
69
|
context "when bad request" do
|
70
70
|
it "should throw an exception" do
|
71
71
|
stub_post("/users", "error_already_exists", 409)
|
72
|
-
expect
|
72
|
+
expect do
|
73
73
|
Gitlab.create_user("email", "pass")
|
74
|
-
|
74
|
+
end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users")
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -84,8 +84,8 @@ describe Gitlab::Client do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should get the correct resource" do
|
87
|
-
body = {:
|
88
|
-
expect(a_post("/users").with(:
|
87
|
+
body = { email: "email", password: "pass", username: "username" }
|
88
|
+
expect(a_post("/users").with(body: body)).to have_been_made
|
89
89
|
end
|
90
90
|
|
91
91
|
it "should return information about a created user" do
|
@@ -96,22 +96,22 @@ describe Gitlab::Client do
|
|
96
96
|
context "when bad request" do
|
97
97
|
it "should throw an exception" do
|
98
98
|
stub_post("/users", "error_already_exists", 409)
|
99
|
-
expect
|
99
|
+
expect do
|
100
100
|
Gitlab.create_user("email", "pass", "username")
|
101
|
-
|
101
|
+
end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users")
|
102
102
|
end
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
106
|
describe ".edit_user" do
|
107
107
|
before do
|
108
|
-
@options = { :
|
109
|
-
stub_put("/users/1", "user").with(:
|
108
|
+
@options = { name: "Roberto" }
|
109
|
+
stub_put("/users/1", "user").with(body: @options)
|
110
110
|
@user = Gitlab.edit_user(1, @options)
|
111
111
|
end
|
112
112
|
|
113
113
|
it "should get the correct resource" do
|
114
|
-
expect(a_put("/users/1").with(:
|
114
|
+
expect(a_put("/users/1").with(body: @options)).to have_been_made
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
@@ -168,16 +168,16 @@ describe Gitlab::Client do
|
|
168
168
|
|
169
169
|
before do
|
170
170
|
stub_request(:post, "#{Gitlab.endpoint}/session").
|
171
|
-
to_return(:
|
171
|
+
to_return(body: load_fixture('session'), status: 200)
|
172
172
|
@session = Gitlab.session("email", "pass")
|
173
173
|
end
|
174
174
|
|
175
175
|
context "when endpoint is not set" do
|
176
176
|
it "should raise Error::MissingCredentials" do
|
177
177
|
Gitlab.endpoint = nil
|
178
|
-
expect
|
178
|
+
expect do
|
179
179
|
Gitlab.session("email", "pass")
|
180
|
-
|
180
|
+
end.to raise_error(Gitlab::Error::MissingCredentials, 'Please set an endpoint to API')
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
@@ -210,8 +210,8 @@ describe Gitlab::Client do
|
|
210
210
|
expect(a_get("/user/keys")).to have_been_made
|
211
211
|
end
|
212
212
|
|
213
|
-
it "should return
|
214
|
-
expect(@keys).to
|
213
|
+
it "should return a paginated response of SSH keys" do
|
214
|
+
expect(@keys).to be_a Gitlab::PaginatedResponse
|
215
215
|
expect(@keys.first.title).to eq("narkoz@helium")
|
216
216
|
end
|
217
217
|
end
|
@@ -238,8 +238,8 @@ describe Gitlab::Client do
|
|
238
238
|
end
|
239
239
|
|
240
240
|
it "should get the correct resource" do
|
241
|
-
body = {:
|
242
|
-
expect(a_post("/user/keys").with(:
|
241
|
+
body = { title: "title", key: "body" }
|
242
|
+
expect(a_post("/user/keys").with(body: body)).to have_been_made
|
243
243
|
end
|
244
244
|
|
245
245
|
it "should return information about a created SSH key" do
|
@@ -261,5 +261,4 @@ describe Gitlab::Client do
|
|
261
261
|
expect(@key.title).to eq("narkoz@helium")
|
262
262
|
end
|
263
263
|
end
|
264
|
-
|
265
264
|
end
|