gitlab 4.2.0 → 4.3.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.
Files changed (84) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +33 -0
  3. data/.travis.yml +8 -3
  4. data/README.md +7 -7
  5. data/Rakefile +11 -3
  6. data/gitlab.gemspec +11 -11
  7. data/lib/gitlab.rb +2 -2
  8. data/lib/gitlab/api.rb +2 -1
  9. data/lib/gitlab/cli.rb +2 -6
  10. data/lib/gitlab/cli_helpers.rb +18 -20
  11. data/lib/gitlab/client.rb +8 -5
  12. data/lib/gitlab/client/branches.rb +4 -4
  13. data/lib/gitlab/client/build_variables.rb +64 -2
  14. data/lib/gitlab/client/deployments.rb +32 -0
  15. data/lib/gitlab/client/groups.rb +49 -0
  16. data/lib/gitlab/client/issues.rb +71 -0
  17. data/lib/gitlab/client/merge_requests.rb +1 -0
  18. data/lib/gitlab/client/pipeline_schedules.rb +133 -0
  19. data/lib/gitlab/client/pipeline_triggers.rb +2 -2
  20. data/lib/gitlab/client/projects.rb +1 -1
  21. data/lib/gitlab/client/repository_files.rb +2 -2
  22. data/lib/gitlab/client/users.rb +5 -5
  23. data/lib/gitlab/configuration.rb +2 -2
  24. data/lib/gitlab/error.rb +10 -2
  25. data/lib/gitlab/file_response.rb +1 -1
  26. data/lib/gitlab/help.rb +5 -6
  27. data/lib/gitlab/page_links.rb +2 -2
  28. data/lib/gitlab/request.rb +34 -50
  29. data/lib/gitlab/shell.rb +5 -8
  30. data/lib/gitlab/version.rb +1 -1
  31. data/spec/fixtures/deployment.json +57 -0
  32. data/spec/fixtures/deployments.json +116 -0
  33. data/spec/fixtures/group_edit.json +14 -0
  34. data/spec/fixtures/group_subgroups.json +16 -0
  35. data/spec/fixtures/pipeline_schedule.json +32 -0
  36. data/spec/fixtures/pipeline_schedule_create.json +21 -0
  37. data/spec/fixtures/pipeline_schedule_update.json +26 -0
  38. data/spec/fixtures/pipeline_schedule_variable.json +5 -0
  39. data/spec/fixtures/pipeline_schedule_variable_update.json +5 -0
  40. data/spec/fixtures/pipeline_schedules.json +22 -0
  41. data/spec/gitlab/api_spec.rb +11 -0
  42. data/spec/gitlab/cli_helpers_spec.rb +14 -15
  43. data/spec/gitlab/cli_spec.rb +11 -11
  44. data/spec/gitlab/client/award_emojis_spec.rb +55 -55
  45. data/spec/gitlab/client/boards_spec.rb +12 -12
  46. data/spec/gitlab/client/branches_spec.rb +22 -22
  47. data/spec/gitlab/client/build_variables_spec.rb +93 -10
  48. data/spec/gitlab/client/builds_spec.rb +36 -36
  49. data/spec/gitlab/client/commits_spec.rb +21 -21
  50. data/spec/gitlab/client/deployments_spec.rb +38 -0
  51. data/spec/gitlab/client/environments_spec.rb +18 -18
  52. data/spec/gitlab/client/groups_spec.rb +73 -22
  53. data/spec/gitlab/client/issues_spec.rb +121 -22
  54. data/spec/gitlab/client/jobs_spec.rb +13 -13
  55. data/spec/gitlab/client/keys_spec.rb +2 -2
  56. data/spec/gitlab/client/labels_spec.rb +12 -12
  57. data/spec/gitlab/client/merge_requests_spec.rb +23 -23
  58. data/spec/gitlab/client/milestones_spec.rb +12 -12
  59. data/spec/gitlab/client/namespaces_spec.rb +3 -3
  60. data/spec/gitlab/client/notes_spec.rb +40 -40
  61. data/spec/gitlab/client/pipeline_schedules_spec.rb +158 -0
  62. data/spec/gitlab/client/pipeline_triggers_spec.rb +17 -17
  63. data/spec/gitlab/client/pipelines_spec.rb +22 -22
  64. data/spec/gitlab/client/projects_spec.rb +75 -75
  65. data/spec/gitlab/client/repositories_spec.rb +16 -16
  66. data/spec/gitlab/client/repository_files_spec.rb +10 -10
  67. data/spec/gitlab/client/runners_spec.rb +20 -22
  68. data/spec/gitlab/client/services_spec.rb +6 -6
  69. data/spec/gitlab/client/snippets_spec.rb +12 -12
  70. data/spec/gitlab/client/system_hooks_spec.rb +12 -12
  71. data/spec/gitlab/client/tags_spec.rb +19 -20
  72. data/spec/gitlab/client/todos_spec.rb +12 -12
  73. data/spec/gitlab/client/users_spec.rb +49 -49
  74. data/spec/gitlab/error_spec.rb +50 -23
  75. data/spec/gitlab/file_response_spec.rb +6 -6
  76. data/spec/gitlab/help_spec.rb +5 -5
  77. data/spec/gitlab/objectified_hash_spec.rb +8 -8
  78. data/spec/gitlab/page_links_spec.rb +1 -1
  79. data/spec/gitlab/paginated_response_spec.rb +4 -4
  80. data/spec/gitlab/request_spec.rb +19 -19
  81. data/spec/gitlab/shell_spec.rb +12 -12
  82. data/spec/gitlab_spec.rb +13 -14
  83. data/spec/spec_helper.rb +10 -45
  84. metadata +46 -3
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Gitlab::Client do
4
- it { should respond_to :repo_commits }
5
- it { should respond_to :repo_commit }
6
- it { should respond_to :repo_commit_diff }
7
- it { should respond_to :repo_commit_comments }
8
- it { should respond_to :repo_create_commit_comment }
9
- it { should respond_to :repo_commit_status }
10
- it { should respond_to :repo_update_commit_status }
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 "should get the correct resource" do
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 "should return a paginated response of repository commits" do
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 "should get the correct resource" do
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 "should return a repository commit" do
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 "should get the correct resource" do
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 "should return a diff of a commit" do
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 "should get the correct resource" do
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 "should return commit's comments" do
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 "should return information about the newly created comment" do
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 "should get the correct resource" do
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 "should get statuses of a commit" do
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 "should get the correct resource" do
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 "should information about the newly created status" do
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 "should return id of a created commit" do
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 "should get the correct resource" do
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 "should return a paginated response of project's environments" do
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 "should get the correct resource" do
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 "should return a single environment" do
29
+ it "returns a single environment" do
30
30
  expect(@environment).to be_a Gitlab::ObjectifiedHash
31
31
  end
32
32
 
33
- it "should return information about an environment" do
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 "should get the correct resource" do
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 "should return a single environment" do
50
+ it "returns a single environment" do
51
51
  expect(@environment).to be_a Gitlab::ObjectifiedHash
52
52
  end
53
53
 
54
- it "should return information about an environment" do
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 "should get the correct resource" do
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 "should get the correct resource" do
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 "should return a single environment" do
86
+ it "returns a single environment" do
87
87
  expect(@environment).to be_a Gitlab::ObjectifiedHash
88
88
  end
89
89
 
90
- it "should return information about an environment" do
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 "should get the correct resource" do
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 "should return a single pipeline" do
105
+ it "returns a single pipeline" do
106
106
  expect(@environment).to be_a Gitlab::ObjectifiedHash
107
107
  end
108
108
 
109
- it "should return information about a pipeline" do
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 "should get the correct resource" do
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 "should return a single pipeline" do
124
+ it "returns a single pipeline" do
125
125
  expect(@environment).to be_a Gitlab::ObjectifiedHash
126
126
  end
127
127
 
128
- it "should return information about a pipeline" do
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 "should get the correct resource" do
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 "should return a paginated response of groups" do
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 "should get the correct resource" do
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 "should return information about a created group" do
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 "should get the correct resource" do
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 "should return information about a created group" do
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 "should get the correct resource" do
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 "should return information about a deleted group" do
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 "should post to the correct resource" do
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 "should return information about the group" do
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 "should get the correct resource" do
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 "should return information about a group members" do
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 "should get the correct resource" do
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 "should return information about the added member" do
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 "should get the correct resource" do
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 "should return information about the edited member" do
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 "should get the correct resource" do
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 "should return information about the group the member was removed from" do
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 "should get the list of projects" do
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 "should return a list of of projects under a group" do
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 "should get the correct resource" do
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 "should return an array of groups found" do
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