gitlab 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +33 -0
- data/.travis.yml +8 -3
- data/README.md +7 -7
- data/Rakefile +11 -3
- data/gitlab.gemspec +11 -11
- data/lib/gitlab.rb +2 -2
- data/lib/gitlab/api.rb +2 -1
- data/lib/gitlab/cli.rb +2 -6
- data/lib/gitlab/cli_helpers.rb +18 -20
- data/lib/gitlab/client.rb +8 -5
- data/lib/gitlab/client/branches.rb +4 -4
- data/lib/gitlab/client/build_variables.rb +64 -2
- data/lib/gitlab/client/deployments.rb +32 -0
- data/lib/gitlab/client/groups.rb +49 -0
- data/lib/gitlab/client/issues.rb +71 -0
- data/lib/gitlab/client/merge_requests.rb +1 -0
- data/lib/gitlab/client/pipeline_schedules.rb +133 -0
- data/lib/gitlab/client/pipeline_triggers.rb +2 -2
- data/lib/gitlab/client/projects.rb +1 -1
- data/lib/gitlab/client/repository_files.rb +2 -2
- data/lib/gitlab/client/users.rb +5 -5
- data/lib/gitlab/configuration.rb +2 -2
- data/lib/gitlab/error.rb +10 -2
- data/lib/gitlab/file_response.rb +1 -1
- data/lib/gitlab/help.rb +5 -6
- data/lib/gitlab/page_links.rb +2 -2
- data/lib/gitlab/request.rb +34 -50
- data/lib/gitlab/shell.rb +5 -8
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/deployment.json +57 -0
- data/spec/fixtures/deployments.json +116 -0
- data/spec/fixtures/group_edit.json +14 -0
- data/spec/fixtures/group_subgroups.json +16 -0
- data/spec/fixtures/pipeline_schedule.json +32 -0
- data/spec/fixtures/pipeline_schedule_create.json +21 -0
- data/spec/fixtures/pipeline_schedule_update.json +26 -0
- data/spec/fixtures/pipeline_schedule_variable.json +5 -0
- data/spec/fixtures/pipeline_schedule_variable_update.json +5 -0
- data/spec/fixtures/pipeline_schedules.json +22 -0
- data/spec/gitlab/api_spec.rb +11 -0
- data/spec/gitlab/cli_helpers_spec.rb +14 -15
- data/spec/gitlab/cli_spec.rb +11 -11
- data/spec/gitlab/client/award_emojis_spec.rb +55 -55
- data/spec/gitlab/client/boards_spec.rb +12 -12
- data/spec/gitlab/client/branches_spec.rb +22 -22
- data/spec/gitlab/client/build_variables_spec.rb +93 -10
- data/spec/gitlab/client/builds_spec.rb +36 -36
- data/spec/gitlab/client/commits_spec.rb +21 -21
- data/spec/gitlab/client/deployments_spec.rb +38 -0
- data/spec/gitlab/client/environments_spec.rb +18 -18
- data/spec/gitlab/client/groups_spec.rb +73 -22
- data/spec/gitlab/client/issues_spec.rb +121 -22
- data/spec/gitlab/client/jobs_spec.rb +13 -13
- data/spec/gitlab/client/keys_spec.rb +2 -2
- data/spec/gitlab/client/labels_spec.rb +12 -12
- data/spec/gitlab/client/merge_requests_spec.rb +23 -23
- data/spec/gitlab/client/milestones_spec.rb +12 -12
- data/spec/gitlab/client/namespaces_spec.rb +3 -3
- data/spec/gitlab/client/notes_spec.rb +40 -40
- data/spec/gitlab/client/pipeline_schedules_spec.rb +158 -0
- data/spec/gitlab/client/pipeline_triggers_spec.rb +17 -17
- data/spec/gitlab/client/pipelines_spec.rb +22 -22
- data/spec/gitlab/client/projects_spec.rb +75 -75
- data/spec/gitlab/client/repositories_spec.rb +16 -16
- data/spec/gitlab/client/repository_files_spec.rb +10 -10
- data/spec/gitlab/client/runners_spec.rb +20 -22
- data/spec/gitlab/client/services_spec.rb +6 -6
- data/spec/gitlab/client/snippets_spec.rb +12 -12
- data/spec/gitlab/client/system_hooks_spec.rb +12 -12
- data/spec/gitlab/client/tags_spec.rb +19 -20
- data/spec/gitlab/client/todos_spec.rb +12 -12
- data/spec/gitlab/client/users_spec.rb +49 -49
- data/spec/gitlab/error_spec.rb +50 -23
- data/spec/gitlab/file_response_spec.rb +6 -6
- data/spec/gitlab/help_spec.rb +5 -5
- data/spec/gitlab/objectified_hash_spec.rb +8 -8
- data/spec/gitlab/page_links_spec.rb +1 -1
- data/spec/gitlab/paginated_response_spec.rb +4 -4
- data/spec/gitlab/request_spec.rb +19 -19
- data/spec/gitlab/shell_spec.rb +12 -12
- data/spec/gitlab_spec.rb +13 -14
- data/spec/spec_helper.rb +10 -45
- metadata +46 -3
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Gitlab::Client do
|
4
|
-
it {
|
5
|
-
it {
|
6
|
-
it {
|
7
|
-
it {
|
8
|
-
it {
|
9
|
-
it {
|
10
|
-
it {
|
4
|
+
it { is_expected.to respond_to :repo_commits }
|
5
|
+
it { is_expected.to respond_to :repo_commit }
|
6
|
+
it { is_expected.to respond_to :repo_commit_diff }
|
7
|
+
it { is_expected.to respond_to :repo_commit_comments }
|
8
|
+
it { is_expected.to respond_to :repo_create_commit_comment }
|
9
|
+
it { is_expected.to respond_to :repo_commit_status }
|
10
|
+
it { is_expected.to respond_to :repo_update_commit_status }
|
11
11
|
|
12
12
|
describe ".commits" do
|
13
13
|
before do
|
@@ -16,12 +16,12 @@ describe Gitlab::Client do
|
|
16
16
|
@commits = Gitlab.commits(3, ref_name: "api")
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "gets the correct resource" do
|
20
20
|
expect(a_get("/projects/3/repository/commits").
|
21
21
|
with(query: { ref_name: "api" })).to have_been_made
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "returns a paginated response of repository commits" do
|
25
25
|
expect(@commits).to be_a Gitlab::PaginatedResponse
|
26
26
|
expect(@commits.first.id).to eq("f7dd067490fe57505f7226c3b54d3127d2f7fd46")
|
27
27
|
end
|
@@ -33,12 +33,12 @@ describe Gitlab::Client do
|
|
33
33
|
@commit = Gitlab.commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "gets the correct resource" do
|
37
37
|
expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6")).
|
38
38
|
to have_been_made
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "returns a repository commit" do
|
42
42
|
expect(@commit.id).to eq("6104942438c14ec7bd21c6cd5bd995272b3faff6")
|
43
43
|
end
|
44
44
|
end
|
@@ -49,12 +49,12 @@ describe Gitlab::Client do
|
|
49
49
|
@diff = Gitlab.commit_diff(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
|
50
50
|
end
|
51
51
|
|
52
|
-
it "
|
52
|
+
it "gets the correct resource" do
|
53
53
|
expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff")).
|
54
54
|
to have_been_made
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "returns a diff of a commit" do
|
58
58
|
expect(@diff.new_path).to eq("doc/update/5.4-to-6.0.md")
|
59
59
|
end
|
60
60
|
end
|
@@ -65,12 +65,12 @@ describe Gitlab::Client do
|
|
65
65
|
@commit_comments = Gitlab.commit_comments(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
|
66
66
|
end
|
67
67
|
|
68
|
-
it "
|
68
|
+
it "gets the correct resource" do
|
69
69
|
expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments")).
|
70
70
|
to have_been_made
|
71
71
|
end
|
72
72
|
|
73
|
-
it "
|
73
|
+
it "returns commit's comments" do
|
74
74
|
expect(@commit_comments).to be_a Gitlab::PaginatedResponse
|
75
75
|
expect(@commit_comments.length).to eq(2)
|
76
76
|
expect(@commit_comments[0].note).to eq("this is the 1st comment on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6")
|
@@ -86,7 +86,7 @@ describe Gitlab::Client do
|
|
86
86
|
@merge_request = Gitlab.create_commit_comment(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'Nice code!')
|
87
87
|
end
|
88
88
|
|
89
|
-
it "
|
89
|
+
it "returns information about the newly created comment" do
|
90
90
|
expect(@merge_request.note).to eq('Nice code!')
|
91
91
|
expect(@merge_request.author.id).to eq(1)
|
92
92
|
end
|
@@ -99,12 +99,12 @@ describe Gitlab::Client do
|
|
99
99
|
@statuses = Gitlab.commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', all: true)
|
100
100
|
end
|
101
101
|
|
102
|
-
it "
|
102
|
+
it "gets the correct resource" do
|
103
103
|
expect(a_get("/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses").
|
104
104
|
with(query: { all: true }))
|
105
105
|
end
|
106
106
|
|
107
|
-
it "
|
107
|
+
it "gets statuses of a commit" do
|
108
108
|
expect(@statuses).to be_kind_of Gitlab::PaginatedResponse
|
109
109
|
expect(@statuses.first.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8')
|
110
110
|
expect(@statuses.first.ref).to eq('decreased-spec')
|
@@ -121,12 +121,12 @@ describe Gitlab::Client do
|
|
121
121
|
@status = Gitlab.update_commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', 'failed', name: 'test', ref: 'decreased-spec')
|
122
122
|
end
|
123
123
|
|
124
|
-
it "
|
124
|
+
it "gets the correct resource" do
|
125
125
|
expect(a_post('/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8').
|
126
126
|
with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' }))
|
127
127
|
end
|
128
128
|
|
129
|
-
it "
|
129
|
+
it "returns information about the newly created status" do
|
130
130
|
expect(@status).to be_kind_of Gitlab::ObjectifiedHash
|
131
131
|
expect(@status.id).to eq(498)
|
132
132
|
expect(@status.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8')
|
@@ -161,7 +161,7 @@ describe Gitlab::Client do
|
|
161
161
|
@commit = Gitlab.create_commit(6, 'dev', 'refactors everything', actions, {author_email: 'joe@sample.org', author_name: 'Joe Sample'})
|
162
162
|
end
|
163
163
|
|
164
|
-
it "
|
164
|
+
it "returns id of a created commit" do
|
165
165
|
expect(@commit.id).to eq('ed899a2f4b50b4370feeea94676502b42383c746')
|
166
166
|
end
|
167
167
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gitlab::Client do
|
4
|
+
describe ".deployments" do
|
5
|
+
before do
|
6
|
+
stub_get("/projects/3/deployments", "deployments")
|
7
|
+
@deployments = Gitlab.deployments(3)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "gets the correct resource" do
|
11
|
+
expect(a_get("/projects/3/deployments")).to have_been_made
|
12
|
+
end
|
13
|
+
|
14
|
+
it "returns a paginated response of project's deployments" do
|
15
|
+
expect(@deployments).to be_a Gitlab::PaginatedResponse
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".deployment" do
|
20
|
+
before do
|
21
|
+
stub_get("/projects/3/deployments/42", "deployment")
|
22
|
+
@deployment = Gitlab.deployment(3, 42)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "gets the correct resource" do
|
26
|
+
expect(a_get("/projects/3/deployments/42")).to have_been_made
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns a single deployment" do
|
30
|
+
expect(@deployment).to be_a Gitlab::ObjectifiedHash
|
31
|
+
end
|
32
|
+
|
33
|
+
it "returns information about an deployment" do
|
34
|
+
expect(@deployment.id).to eq(42)
|
35
|
+
expect(@deployment.deployable.commit.id).to eq("a91957a858320c0e17f3a0eca7cfacbff50ea29a")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -7,11 +7,11 @@ describe Gitlab::Client do
|
|
7
7
|
@environments = Gitlab.environments(3)
|
8
8
|
end
|
9
9
|
|
10
|
-
it "
|
10
|
+
it "gets the correct resource" do
|
11
11
|
expect(a_get("/projects/3/environments")).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
-
it "
|
14
|
+
it "returns a paginated response of project's environments" do
|
15
15
|
expect(@environments).to be_a Gitlab::PaginatedResponse
|
16
16
|
end
|
17
17
|
end
|
@@ -22,15 +22,15 @@ describe Gitlab::Client do
|
|
22
22
|
@environment = Gitlab.environment(3, 12)
|
23
23
|
end
|
24
24
|
|
25
|
-
it "
|
25
|
+
it "gets the correct resource" do
|
26
26
|
expect(a_get("/projects/3/environments/12")).to have_been_made
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "returns a single environment" do
|
30
30
|
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "returns information about an environment" do
|
34
34
|
expect(@environment.id).to eq(12)
|
35
35
|
expect(@environment.name).to eq("staging")
|
36
36
|
end
|
@@ -43,15 +43,15 @@ describe Gitlab::Client do
|
|
43
43
|
@environment = Gitlab.create_environment(3, 'staging')
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
46
|
+
it "gets the correct resource" do
|
47
47
|
expect(a_post("/projects/3/environments").with(body: { name: 'staging' })).to have_been_made
|
48
48
|
end
|
49
49
|
|
50
|
-
it "
|
50
|
+
it "returns a single environment" do
|
51
51
|
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
52
52
|
end
|
53
53
|
|
54
|
-
it "
|
54
|
+
it "returns information about an environment" do
|
55
55
|
expect(@environment.name).to eq("staging")
|
56
56
|
end
|
57
57
|
end
|
@@ -62,7 +62,7 @@ describe Gitlab::Client do
|
|
62
62
|
@environment = Gitlab.create_environment(3, 'staging', external_url: "https://staging.example.gitlab.com")
|
63
63
|
end
|
64
64
|
|
65
|
-
it "
|
65
|
+
it "gets the correct resource" do
|
66
66
|
expect(a_post("/projects/3/environments")
|
67
67
|
.with(body: { name: 'staging', external_url: "https://staging.example.gitlab.com" })).to have_been_made
|
68
68
|
end
|
@@ -78,16 +78,16 @@ describe Gitlab::Client do
|
|
78
78
|
})
|
79
79
|
end
|
80
80
|
|
81
|
-
it "
|
81
|
+
it "gets the correct resource" do
|
82
82
|
expect(a_put("/projects/3/environments/12")
|
83
83
|
.with(body: { name: 'staging', external_url: "https://staging.example.gitlab.com" })).to have_been_made
|
84
84
|
end
|
85
85
|
|
86
|
-
it "
|
86
|
+
it "returns a single environment" do
|
87
87
|
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
88
88
|
end
|
89
89
|
|
90
|
-
it "
|
90
|
+
it "returns information about an environment" do
|
91
91
|
expect(@environment.name).to eq("staging")
|
92
92
|
end
|
93
93
|
end
|
@@ -98,15 +98,15 @@ describe Gitlab::Client do
|
|
98
98
|
@environment = Gitlab.delete_environment(3, 12)
|
99
99
|
end
|
100
100
|
|
101
|
-
it "
|
101
|
+
it "gets the correct resource" do
|
102
102
|
expect(a_delete("/projects/3/environments/12")).to have_been_made
|
103
103
|
end
|
104
104
|
|
105
|
-
it "
|
105
|
+
it "returns a single pipeline" do
|
106
106
|
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
107
107
|
end
|
108
108
|
|
109
|
-
it "
|
109
|
+
it "returns information about a pipeline" do
|
110
110
|
expect(@environment.name).to eq("staging")
|
111
111
|
end
|
112
112
|
end
|
@@ -117,15 +117,15 @@ describe Gitlab::Client do
|
|
117
117
|
@environment = Gitlab.stop_environment(3, 12)
|
118
118
|
end
|
119
119
|
|
120
|
-
it "
|
120
|
+
it "gets the correct resource" do
|
121
121
|
expect(a_post("/projects/3/environments/12/stop")).to have_been_made
|
122
122
|
end
|
123
123
|
|
124
|
-
it "
|
124
|
+
it "returns a single pipeline" do
|
125
125
|
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
126
126
|
end
|
127
127
|
|
128
|
-
it "
|
128
|
+
it "returns information about a pipeline" do
|
129
129
|
expect(@environment.name).to eq("staging")
|
130
130
|
end
|
131
131
|
end
|
@@ -9,12 +9,12 @@ describe Gitlab::Client do
|
|
9
9
|
@groups = Gitlab.groups
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "gets the correct resource" do
|
13
13
|
expect(a_get("/groups")).to have_been_made
|
14
14
|
expect(a_get("/groups/3")).to have_been_made
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "returns a paginated response of groups" do
|
18
18
|
expect(@groups).to be_a Gitlab::PaginatedResponse
|
19
19
|
expect(@groups.first.path).to eq("threegroup")
|
20
20
|
end
|
@@ -27,12 +27,12 @@ describe Gitlab::Client do
|
|
27
27
|
@group = Gitlab.create_group('GitLab-Group', 'gitlab-path')
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "gets the correct resource" do
|
31
31
|
expect(a_post("/groups").
|
32
32
|
with(body: { path: 'gitlab-path', name: 'GitLab-Group' })).to have_been_made
|
33
33
|
end
|
34
34
|
|
35
|
-
it "
|
35
|
+
it "returns information about a created group" do
|
36
36
|
expect(@group.name).to eq("Gitlab-Group")
|
37
37
|
expect(@group.path).to eq("gitlab-group")
|
38
38
|
end
|
@@ -44,13 +44,13 @@ describe Gitlab::Client do
|
|
44
44
|
@group = Gitlab.create_group('GitLab-Group', 'gitlab-path', description: 'gitlab group description')
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
47
|
+
it "gets the correct resource" do
|
48
48
|
expect(a_post("/groups").
|
49
49
|
with(body: { path: 'gitlab-path', name: 'GitLab-Group',
|
50
50
|
description: 'gitlab group description' })).to have_been_made
|
51
51
|
end
|
52
52
|
|
53
|
-
it "
|
53
|
+
it "returns information about a created group" do
|
54
54
|
expect(@group.name).to eq("Gitlab-Group")
|
55
55
|
expect(@group.path).to eq("gitlab-group")
|
56
56
|
expect(@group.description).to eq("gitlab group description")
|
@@ -64,11 +64,11 @@ describe Gitlab::Client do
|
|
64
64
|
@group = Gitlab.delete_group(42)
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
67
|
+
it "gets the correct resource" do
|
68
68
|
expect(a_delete("/groups/42")).to have_been_made
|
69
69
|
end
|
70
70
|
|
71
|
-
it "
|
71
|
+
it "returns information about a deleted group" do
|
72
72
|
expect(@group.name).to eq("Gitlab-Group")
|
73
73
|
expect(@group.path).to eq("gitlab-group")
|
74
74
|
end
|
@@ -85,11 +85,11 @@ describe Gitlab::Client do
|
|
85
85
|
@group_transfer = Gitlab.transfer_project_to_group(@group.id, @project.id)
|
86
86
|
end
|
87
87
|
|
88
|
-
it "
|
88
|
+
it "posts to the correct resource" do
|
89
89
|
expect(a_post("/groups/#{@group.id}/projects/#{@project.id}").with(body: { id: @group.id.to_s, project_id: @project.id.to_s })).to have_been_made
|
90
90
|
end
|
91
91
|
|
92
|
-
it "
|
92
|
+
it "returns information about the group" do
|
93
93
|
expect(@group_transfer.name).to eq(@group.name)
|
94
94
|
expect(@group_transfer.path).to eq(@group.path)
|
95
95
|
expect(@group_transfer.id).to eq(@group.id)
|
@@ -102,29 +102,46 @@ describe Gitlab::Client do
|
|
102
102
|
@members = Gitlab.group_members(3)
|
103
103
|
end
|
104
104
|
|
105
|
-
it "
|
105
|
+
it "gets the correct resource" do
|
106
106
|
expect(a_get("/groups/3/members")).to have_been_made
|
107
107
|
end
|
108
108
|
|
109
|
-
it "
|
109
|
+
it "returns information about a group's members" do
|
110
110
|
expect(@members).to be_a Gitlab::PaginatedResponse
|
111
111
|
expect(@members.size).to eq(2)
|
112
112
|
expect(@members[1].name).to eq("John Smith")
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
describe ".group_member" do
|
117
|
+
before do
|
118
|
+
stub_get("/groups/3/members/2", "group_member")
|
119
|
+
@member = Gitlab.group_member(3, 2)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "gets the correct resource" do
|
123
|
+
expect(a_get("/groups/3/members/2")).to have_been_made
|
124
|
+
end
|
125
|
+
|
126
|
+
it "returns information about a group member" do
|
127
|
+
expect(@member).to be_a Gitlab::ObjectifiedHash
|
128
|
+
expect(@member.access_level).to eq(10)
|
129
|
+
expect(@member.name).to eq("John Smith")
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
116
133
|
describe ".add_group_member" do
|
117
134
|
before do
|
118
135
|
stub_post("/groups/3/members", "group_member")
|
119
136
|
@member = Gitlab.add_group_member(3, 1, 40)
|
120
137
|
end
|
121
138
|
|
122
|
-
it "
|
139
|
+
it "gets the correct resource" do
|
123
140
|
expect(a_post("/groups/3/members").
|
124
141
|
with(body: { user_id: '1', access_level: '40' })).to have_been_made
|
125
142
|
end
|
126
143
|
|
127
|
-
it "
|
144
|
+
it "returns information about the added member" do
|
128
145
|
expect(@member.name).to eq("John Smith")
|
129
146
|
end
|
130
147
|
end
|
@@ -135,12 +152,12 @@ describe Gitlab::Client do
|
|
135
152
|
@member = Gitlab.edit_group_member(3, 1, 50)
|
136
153
|
end
|
137
154
|
|
138
|
-
it "
|
155
|
+
it "gets the correct resource" do
|
139
156
|
expect(a_put("/groups/3/members/1")
|
140
157
|
.with(body: { access_level: '50'})).to have_been_made
|
141
158
|
end
|
142
159
|
|
143
|
-
it "
|
160
|
+
it "returns information about the edited member" do
|
144
161
|
expect(@member.access_level).to eq(50)
|
145
162
|
end
|
146
163
|
end
|
@@ -151,11 +168,11 @@ describe Gitlab::Client do
|
|
151
168
|
@group = Gitlab.remove_group_member(3, 1)
|
152
169
|
end
|
153
170
|
|
154
|
-
it "
|
171
|
+
it "gets the correct resource" do
|
155
172
|
expect(a_delete("/groups/3/members/1")).to have_been_made
|
156
173
|
end
|
157
174
|
|
158
|
-
it "
|
175
|
+
it "returns information about the group the member was removed from" do
|
159
176
|
expect(@group.group_id).to eq(3)
|
160
177
|
end
|
161
178
|
end
|
@@ -166,11 +183,11 @@ describe Gitlab::Client do
|
|
166
183
|
@projects = Gitlab.group_projects(4)
|
167
184
|
end
|
168
185
|
|
169
|
-
it "
|
186
|
+
it "gets the list of projects" do
|
170
187
|
expect(a_get("/groups/4/projects")).to have_been_made
|
171
188
|
end
|
172
189
|
|
173
|
-
it "
|
190
|
+
it "returns a list of of projects under a group" do
|
174
191
|
expect(@projects).to be_a Gitlab::PaginatedResponse
|
175
192
|
expect(@projects.size).to eq(1)
|
176
193
|
expect(@projects[0].name).to eq("Diaspora Client")
|
@@ -183,13 +200,47 @@ describe Gitlab::Client do
|
|
183
200
|
@groups = Gitlab.group_search('Group')
|
184
201
|
end
|
185
202
|
|
186
|
-
it "
|
203
|
+
it "gets the correct resource" do
|
187
204
|
expect(a_get("/groups?search=Group")).to have_been_made
|
188
205
|
end
|
189
206
|
|
190
|
-
it "
|
207
|
+
it "returns an array of groups found" do
|
191
208
|
expect(@groups.first.id).to eq(5)
|
192
209
|
expect(@groups.last.id).to eq(8)
|
193
210
|
end
|
194
211
|
end
|
212
|
+
|
213
|
+
describe ".group_subgroups" do
|
214
|
+
before do
|
215
|
+
stub_get("/groups/4/subgroups", "group_subgroups")
|
216
|
+
@subgroups = Gitlab.group_subgroups(4)
|
217
|
+
end
|
218
|
+
|
219
|
+
it "gets the list of subroups" do
|
220
|
+
expect(a_get("/groups/4/subgroups")).to have_been_made
|
221
|
+
end
|
222
|
+
|
223
|
+
it "returns an array of subgroups under a group" do
|
224
|
+
expect(@subgroups).to be_a Gitlab::PaginatedResponse
|
225
|
+
expect(@subgroups.size).to eq(1)
|
226
|
+
expect(@subgroups[0].name).to eq("Foobar Group")
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
describe ".edit_group" do
|
231
|
+
context "using group ID" do
|
232
|
+
before do
|
233
|
+
stub_put("/groups/1", "group_edit").with(body: { description: "An interesting group" })
|
234
|
+
@edited_project = Gitlab.edit_group(1, description: "An interesting group")
|
235
|
+
end
|
236
|
+
|
237
|
+
it "gets the correct resource" do
|
238
|
+
expect(a_put("/groups/1").with(body: { description: "An interesting group" })).to have_been_made
|
239
|
+
end
|
240
|
+
|
241
|
+
it "returns information about an edited group" do
|
242
|
+
expect(@edited_project.description).to eq("An interesting group")
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
195
246
|
end
|