gitlab 4.2.0 → 4.18.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 (271) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +4 -2
  3. data/LICENSE.txt +1 -1
  4. data/README.md +96 -25
  5. data/exe/gitlab +5 -1
  6. data/lib/gitlab/api.rb +8 -3
  7. data/lib/gitlab/cli.rb +15 -15
  8. data/lib/gitlab/cli_helpers.rb +63 -61
  9. data/lib/gitlab/client/access_requests.rb +103 -0
  10. data/lib/gitlab/client/application_settings.rb +172 -0
  11. data/lib/gitlab/client/avatar.rb +21 -0
  12. data/lib/gitlab/client/award_emojis.rb +5 -3
  13. data/lib/gitlab/client/boards.rb +62 -4
  14. data/lib/gitlab/client/branches.rb +53 -14
  15. data/lib/gitlab/client/broadcast_messages.rb +75 -0
  16. data/lib/gitlab/client/build_variables.rb +78 -9
  17. data/lib/gitlab/client/builds.rb +13 -11
  18. data/lib/gitlab/client/commits.rb +89 -19
  19. data/lib/gitlab/client/container_registry.rb +85 -0
  20. data/lib/gitlab/client/deployments.rb +34 -0
  21. data/lib/gitlab/client/environments.rb +5 -3
  22. data/lib/gitlab/client/epic_issues.rb +23 -0
  23. data/lib/gitlab/client/epics.rb +73 -0
  24. data/lib/gitlab/client/events.rb +60 -0
  25. data/lib/gitlab/client/features.rb +48 -0
  26. data/lib/gitlab/client/group_badges.rb +88 -0
  27. data/lib/gitlab/client/group_boards.rb +141 -0
  28. data/lib/gitlab/client/group_labels.rb +88 -0
  29. data/lib/gitlab/client/group_milestones.rb +94 -0
  30. data/lib/gitlab/client/groups.rb +197 -17
  31. data/lib/gitlab/client/issue_links.rb +48 -0
  32. data/lib/gitlab/client/issues.rb +98 -4
  33. data/lib/gitlab/client/jobs.rb +96 -8
  34. data/lib/gitlab/client/keys.rb +13 -0
  35. data/lib/gitlab/client/labels.rb +7 -5
  36. data/lib/gitlab/client/lint.rb +19 -0
  37. data/lib/gitlab/client/markdown.rb +23 -0
  38. data/lib/gitlab/client/merge_request_approvals.rb +265 -0
  39. data/lib/gitlab/client/merge_requests.rb +237 -9
  40. data/lib/gitlab/client/milestones.rb +19 -5
  41. data/lib/gitlab/client/namespaces.rb +4 -2
  42. data/lib/gitlab/client/notes.rb +58 -12
  43. data/lib/gitlab/client/pipeline_schedules.rb +147 -0
  44. data/lib/gitlab/client/pipeline_triggers.rb +12 -10
  45. data/lib/gitlab/client/pipelines.rb +40 -3
  46. data/lib/gitlab/client/project_badges.rb +85 -0
  47. data/lib/gitlab/client/project_clusters.rb +83 -0
  48. data/lib/gitlab/client/project_release_links.rb +76 -0
  49. data/lib/gitlab/client/project_releases.rb +79 -0
  50. data/lib/gitlab/client/projects.rb +280 -47
  51. data/lib/gitlab/client/protected_tags.rb +59 -0
  52. data/lib/gitlab/client/remote_mirrors.rb +51 -0
  53. data/lib/gitlab/client/repositories.rb +60 -6
  54. data/lib/gitlab/client/repository_files.rb +23 -5
  55. data/lib/gitlab/client/repository_submodules.rb +27 -0
  56. data/lib/gitlab/client/resource_label_events.rb +82 -0
  57. data/lib/gitlab/client/resource_state_events.rb +57 -0
  58. data/lib/gitlab/client/runners.rb +111 -15
  59. data/lib/gitlab/client/search.rb +66 -0
  60. data/lib/gitlab/client/services.rb +4 -1
  61. data/lib/gitlab/client/sidekiq.rb +39 -0
  62. data/lib/gitlab/client/snippets.rb +8 -4
  63. data/lib/gitlab/client/system_hooks.rb +9 -7
  64. data/lib/gitlab/client/tags.rb +15 -14
  65. data/lib/gitlab/client/templates.rb +100 -0
  66. data/lib/gitlab/client/todos.rb +7 -5
  67. data/lib/gitlab/client/user_snippets.rb +114 -0
  68. data/lib/gitlab/client/users.rb +166 -30
  69. data/lib/gitlab/client/versions.rb +18 -0
  70. data/lib/gitlab/client/wikis.rb +79 -0
  71. data/lib/gitlab/client.rb +49 -12
  72. data/lib/gitlab/configuration.rb +8 -6
  73. data/lib/gitlab/error.rb +74 -5
  74. data/lib/gitlab/file_response.rb +5 -3
  75. data/lib/gitlab/help.rb +19 -20
  76. data/lib/gitlab/objectified_hash.rb +27 -10
  77. data/lib/gitlab/page_links.rb +11 -9
  78. data/lib/gitlab/paginated_response.rb +37 -24
  79. data/lib/gitlab/request.rb +42 -53
  80. data/lib/gitlab/shell.rb +11 -12
  81. data/lib/gitlab/shell_history.rb +11 -13
  82. data/lib/gitlab/version.rb +3 -1
  83. data/lib/gitlab.rb +19 -8
  84. metadata +50 -395
  85. data/.gitignore +0 -22
  86. data/.travis.yml +0 -8
  87. data/CONTRIBUTING.md +0 -195
  88. data/Gemfile +0 -4
  89. data/Rakefile +0 -9
  90. data/bin/console +0 -10
  91. data/bin/setup +0 -6
  92. data/gitlab.gemspec +0 -31
  93. data/spec/fixtures/board_list.json +0 -1
  94. data/spec/fixtures/board_lists.json +0 -1
  95. data/spec/fixtures/boards.json +0 -1
  96. data/spec/fixtures/branch.json +0 -1
  97. data/spec/fixtures/branch_delete.json +0 -3
  98. data/spec/fixtures/branches.json +0 -1
  99. data/spec/fixtures/build.json +0 -38
  100. data/spec/fixtures/build_artifacts.json +0 -0
  101. data/spec/fixtures/build_cancel.json +0 -24
  102. data/spec/fixtures/build_erase.json +0 -24
  103. data/spec/fixtures/build_retry.json +0 -24
  104. data/spec/fixtures/builds.json +0 -78
  105. data/spec/fixtures/builds_commits.json +0 -64
  106. data/spec/fixtures/compare_merge_request_diff.json +0 -31
  107. data/spec/fixtures/empty.json +0 -0
  108. data/spec/fixtures/environment.json +0 -6
  109. data/spec/fixtures/environments.json +0 -14
  110. data/spec/fixtures/error_already_exists.json +0 -1
  111. data/spec/fixtures/error_project_not_found.json +0 -1
  112. data/spec/fixtures/get_repository_file.json +0 -1
  113. data/spec/fixtures/group.json +0 -60
  114. data/spec/fixtures/group_create.json +0 -1
  115. data/spec/fixtures/group_create_with_description.json +0 -1
  116. data/spec/fixtures/group_delete.json +0 -1
  117. data/spec/fixtures/group_member.json +0 -1
  118. data/spec/fixtures/group_member_delete.json +0 -1
  119. data/spec/fixtures/group_member_edit.json +0 -1
  120. data/spec/fixtures/group_members.json +0 -1
  121. data/spec/fixtures/group_projects.json +0 -44
  122. data/spec/fixtures/group_search.json +0 -2
  123. data/spec/fixtures/groups.json +0 -2
  124. data/spec/fixtures/issue.json +0 -1
  125. data/spec/fixtures/issue_award_emoji.json +0 -16
  126. data/spec/fixtures/issue_award_emojis.json +0 -34
  127. data/spec/fixtures/issues.json +0 -1
  128. data/spec/fixtures/job.json +0 -43
  129. data/spec/fixtures/job_trace.json +0 -1
  130. data/spec/fixtures/jobs.json +0 -91
  131. data/spec/fixtures/key.json +0 -1
  132. data/spec/fixtures/keys.json +0 -1
  133. data/spec/fixtures/label.json +0 -1
  134. data/spec/fixtures/label_unsubscribe.json +0 -1
  135. data/spec/fixtures/labels.json +0 -1
  136. data/spec/fixtures/merge_request.json +0 -1
  137. data/spec/fixtures/merge_request_award_emoji.json +0 -16
  138. data/spec/fixtures/merge_request_award_emojis.json +0 -34
  139. data/spec/fixtures/merge_request_changes.json +0 -1
  140. data/spec/fixtures/merge_request_closes_issues.json +0 -1
  141. data/spec/fixtures/merge_request_comment.json +0 -1
  142. data/spec/fixtures/merge_request_comments.json +0 -1
  143. data/spec/fixtures/merge_request_commits.json +0 -1
  144. data/spec/fixtures/merge_requests.json +0 -1
  145. data/spec/fixtures/milestone.json +0 -1
  146. data/spec/fixtures/milestone_issues.json +0 -1
  147. data/spec/fixtures/milestone_merge_requests.json +0 -1
  148. data/spec/fixtures/milestones.json +0 -1
  149. data/spec/fixtures/namespaces.json +0 -1
  150. data/spec/fixtures/note.json +0 -1
  151. data/spec/fixtures/note_award_emoji.json +0 -16
  152. data/spec/fixtures/note_award_emojis.json +0 -18
  153. data/spec/fixtures/notes.json +0 -1
  154. data/spec/fixtures/pipeline.json +0 -23
  155. data/spec/fixtures/pipeline_cancel.json +0 -23
  156. data/spec/fixtures/pipeline_create.json +0 -23
  157. data/spec/fixtures/pipeline_jobs.json +0 -91
  158. data/spec/fixtures/pipeline_retry.json +0 -23
  159. data/spec/fixtures/pipelines.json +0 -48
  160. data/spec/fixtures/project.json +0 -1
  161. data/spec/fixtures/project_commit.json +0 -13
  162. data/spec/fixtures/project_commit_comment.json +0 -1
  163. data/spec/fixtures/project_commit_comments.json +0 -1
  164. data/spec/fixtures/project_commit_create.json +0 -22
  165. data/spec/fixtures/project_commit_diff.json +0 -10
  166. data/spec/fixtures/project_commit_status.json +0 -42
  167. data/spec/fixtures/project_commits.json +0 -1
  168. data/spec/fixtures/project_edit.json +0 -21
  169. data/spec/fixtures/project_events.json +0 -1
  170. data/spec/fixtures/project_for_user.json +0 -1
  171. data/spec/fixtures/project_fork.json +0 -50
  172. data/spec/fixtures/project_fork_link.json +0 -1
  173. data/spec/fixtures/project_forked_for_user.json +0 -50
  174. data/spec/fixtures/project_hook.json +0 -1
  175. data/spec/fixtures/project_hooks.json +0 -1
  176. data/spec/fixtures/project_issues.json +0 -1
  177. data/spec/fixtures/project_key.json +0 -6
  178. data/spec/fixtures/project_keys.json +0 -6
  179. data/spec/fixtures/project_runner_enable.json +0 -7
  180. data/spec/fixtures/project_runners.json +0 -16
  181. data/spec/fixtures/project_search.json +0 -1
  182. data/spec/fixtures/project_star.json +0 -44
  183. data/spec/fixtures/project_tag_annotated.json +0 -1
  184. data/spec/fixtures/project_tag_lightweight.json +0 -1
  185. data/spec/fixtures/project_tags.json +0 -1
  186. data/spec/fixtures/project_unstar.json +0 -44
  187. data/spec/fixtures/project_update_commit_status.json +0 -20
  188. data/spec/fixtures/projects.json +0 -1
  189. data/spec/fixtures/push_rule.json +0 -1
  190. data/spec/fixtures/raw_file.json +0 -2
  191. data/spec/fixtures/release_create.json +0 -1
  192. data/spec/fixtures/release_update.json +0 -1
  193. data/spec/fixtures/repository_file.json +0 -1
  194. data/spec/fixtures/run_trigger.json +0 -1
  195. data/spec/fixtures/runner.json +0 -26
  196. data/spec/fixtures/runner_delete.json +0 -7
  197. data/spec/fixtures/runner_edit.json +0 -26
  198. data/spec/fixtures/runners.json +0 -16
  199. data/spec/fixtures/runners_all.json +0 -30
  200. data/spec/fixtures/service.json +0 -1
  201. data/spec/fixtures/session.json +0 -1
  202. data/spec/fixtures/shell_history.json +0 -2
  203. data/spec/fixtures/snippet.json +0 -1
  204. data/spec/fixtures/snippet_award_emoji.json +0 -16
  205. data/spec/fixtures/snippet_award_emojis.json +0 -34
  206. data/spec/fixtures/snippet_content.json +0 -3
  207. data/spec/fixtures/snippets.json +0 -1
  208. data/spec/fixtures/system_hook.json +0 -1
  209. data/spec/fixtures/system_hooks.json +0 -1
  210. data/spec/fixtures/tag.json +0 -1
  211. data/spec/fixtures/tag_create.json +0 -1
  212. data/spec/fixtures/tag_create_with_description.json +0 -1
  213. data/spec/fixtures/tag_delete.json +0 -1
  214. data/spec/fixtures/tags.json +0 -1
  215. data/spec/fixtures/team_member.json +0 -1
  216. data/spec/fixtures/team_members.json +0 -1
  217. data/spec/fixtures/todo.json +0 -73
  218. data/spec/fixtures/todos.json +0 -148
  219. data/spec/fixtures/tree.json +0 -1
  220. data/spec/fixtures/trigger.json +0 -10
  221. data/spec/fixtures/triggers.json +0 -12
  222. data/spec/fixtures/user.json +0 -1
  223. data/spec/fixtures/user_block_unblock.json +0 -1
  224. data/spec/fixtures/user_email.json +0 -1
  225. data/spec/fixtures/user_emails.json +0 -1
  226. data/spec/fixtures/user_search.json +0 -1
  227. data/spec/fixtures/users.json +0 -1
  228. data/spec/fixtures/variable.json +0 -4
  229. data/spec/fixtures/variables.json +0 -10
  230. data/spec/gitlab/cli_helpers_spec.rb +0 -57
  231. data/spec/gitlab/cli_spec.rb +0 -119
  232. data/spec/gitlab/client/award_emojis_spec.rb +0 -391
  233. data/spec/gitlab/client/boards_spec.rb +0 -94
  234. data/spec/gitlab/client/branches_spec.rb +0 -116
  235. data/spec/gitlab/client/build_variables_spec.rb +0 -86
  236. data/spec/gitlab/client/builds_spec.rb +0 -148
  237. data/spec/gitlab/client/client_spec.rb +0 -11
  238. data/spec/gitlab/client/commits_spec.rb +0 -168
  239. data/spec/gitlab/client/environments_spec.rb +0 -132
  240. data/spec/gitlab/client/groups_spec.rb +0 -195
  241. data/spec/gitlab/client/issues_spec.rb +0 -186
  242. data/spec/gitlab/client/jobs_spec.rb +0 -135
  243. data/spec/gitlab/client/keys_spec.rb +0 -19
  244. data/spec/gitlab/client/labels_spec.rb +0 -100
  245. data/spec/gitlab/client/merge_requests_spec.rb +0 -224
  246. data/spec/gitlab/client/milestones_spec.rb +0 -98
  247. data/spec/gitlab/client/namespaces_spec.rb +0 -22
  248. data/spec/gitlab/client/notes_spec.rb +0 -333
  249. data/spec/gitlab/client/pipeline_triggers_spec.rb +0 -157
  250. data/spec/gitlab/client/pipelines_spec.rb +0 -95
  251. data/spec/gitlab/client/projects_spec.rb +0 -613
  252. data/spec/gitlab/client/repositories_spec.rb +0 -94
  253. data/spec/gitlab/client/repository_files_spec.rb +0 -95
  254. data/spec/gitlab/client/runners_spec.rb +0 -185
  255. data/spec/gitlab/client/services_spec.rb +0 -55
  256. data/spec/gitlab/client/snippets_spec.rb +0 -100
  257. data/spec/gitlab/client/system_hooks_spec.rb +0 -69
  258. data/spec/gitlab/client/tags_spec.rb +0 -109
  259. data/spec/gitlab/client/todos_spec.rb +0 -45
  260. data/spec/gitlab/client/users_spec.rb +0 -418
  261. data/spec/gitlab/error_spec.rb +0 -45
  262. data/spec/gitlab/file_response_spec.rb +0 -33
  263. data/spec/gitlab/help_spec.rb +0 -46
  264. data/spec/gitlab/objectified_hash_spec.rb +0 -48
  265. data/spec/gitlab/page_links_spec.rb +0 -16
  266. data/spec/gitlab/paginated_response_spec.rb +0 -60
  267. data/spec/gitlab/request_spec.rb +0 -73
  268. data/spec/gitlab/shell_history_spec.rb +0 -53
  269. data/spec/gitlab/shell_spec.rb +0 -80
  270. data/spec/gitlab_spec.rb +0 -97
  271. data/spec/spec_helper.rb +0 -74
@@ -1,195 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gitlab::Client do
4
- describe ".groups" do
5
- before do
6
- stub_get("/groups", "groups")
7
- stub_get("/groups/3", "group")
8
- @group = Gitlab.group(3)
9
- @groups = Gitlab.groups
10
- end
11
-
12
- it "should get the correct resource" do
13
- expect(a_get("/groups")).to have_been_made
14
- expect(a_get("/groups/3")).to have_been_made
15
- end
16
-
17
- it "should return a paginated response of groups" do
18
- expect(@groups).to be_a Gitlab::PaginatedResponse
19
- expect(@groups.first.path).to eq("threegroup")
20
- end
21
- end
22
-
23
- describe ".create_group" do
24
- context "without description" do
25
- before do
26
- stub_post("/groups", "group_create")
27
- @group = Gitlab.create_group('GitLab-Group', 'gitlab-path')
28
- end
29
-
30
- it "should get the correct resource" do
31
- expect(a_post("/groups").
32
- with(body: { path: 'gitlab-path', name: 'GitLab-Group' })).to have_been_made
33
- end
34
-
35
- it "should return information about a created group" do
36
- expect(@group.name).to eq("Gitlab-Group")
37
- expect(@group.path).to eq("gitlab-group")
38
- end
39
- end
40
-
41
- context "with description" do
42
- before do
43
- stub_post("/groups", "group_create_with_description")
44
- @group = Gitlab.create_group('GitLab-Group', 'gitlab-path', description: 'gitlab group description')
45
- end
46
-
47
- it "should get the correct resource" do
48
- expect(a_post("/groups").
49
- with(body: { path: 'gitlab-path', name: 'GitLab-Group',
50
- description: 'gitlab group description' })).to have_been_made
51
- end
52
-
53
- it "should return information about a created group" do
54
- expect(@group.name).to eq("Gitlab-Group")
55
- expect(@group.path).to eq("gitlab-group")
56
- expect(@group.description).to eq("gitlab group description")
57
- end
58
- end
59
- end
60
-
61
- describe ".delete_group" do
62
- before do
63
- stub_delete("/groups/42", "group_delete")
64
- @group = Gitlab.delete_group(42)
65
- end
66
-
67
- it "should get the correct resource" do
68
- expect(a_delete("/groups/42")).to have_been_made
69
- end
70
-
71
- it "should return information about a deleted group" do
72
- expect(@group.name).to eq("Gitlab-Group")
73
- expect(@group.path).to eq("gitlab-group")
74
- end
75
- end
76
-
77
- describe ".transfer_project_to_group" do
78
- before do
79
- stub_post("/projects", "project")
80
- @project = Gitlab.create_project('Gitlab')
81
- stub_post("/groups", "group_create")
82
- @group = Gitlab.create_group('GitLab-Group', 'gitlab-path')
83
-
84
- stub_post("/groups/#{@group.id}/projects/#{@project.id}", "group_create")
85
- @group_transfer = Gitlab.transfer_project_to_group(@group.id, @project.id)
86
- end
87
-
88
- it "should post to the correct resource" do
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
- end
91
-
92
- it "should return information about the group" do
93
- expect(@group_transfer.name).to eq(@group.name)
94
- expect(@group_transfer.path).to eq(@group.path)
95
- expect(@group_transfer.id).to eq(@group.id)
96
- end
97
- end
98
-
99
- describe ".group_members" do
100
- before do
101
- stub_get("/groups/3/members", "group_members")
102
- @members = Gitlab.group_members(3)
103
- end
104
-
105
- it "should get the correct resource" do
106
- expect(a_get("/groups/3/members")).to have_been_made
107
- end
108
-
109
- it "should return information about a group members" do
110
- expect(@members).to be_a Gitlab::PaginatedResponse
111
- expect(@members.size).to eq(2)
112
- expect(@members[1].name).to eq("John Smith")
113
- end
114
- end
115
-
116
- describe ".add_group_member" do
117
- before do
118
- stub_post("/groups/3/members", "group_member")
119
- @member = Gitlab.add_group_member(3, 1, 40)
120
- end
121
-
122
- it "should get the correct resource" do
123
- expect(a_post("/groups/3/members").
124
- with(body: { user_id: '1', access_level: '40' })).to have_been_made
125
- end
126
-
127
- it "should return information about the added member" do
128
- expect(@member.name).to eq("John Smith")
129
- end
130
- end
131
-
132
- describe ".edit_group_member" do
133
- before do
134
- stub_put("/groups/3/members/1", "group_member_edit")
135
- @member = Gitlab.edit_group_member(3, 1, 50)
136
- end
137
-
138
- it "should get the correct resource" do
139
- expect(a_put("/groups/3/members/1")
140
- .with(body: { access_level: '50'})).to have_been_made
141
- end
142
-
143
- it "should return information about the edited member" do
144
- expect(@member.access_level).to eq(50)
145
- end
146
- end
147
-
148
- describe ".remove_group_member" do
149
- before do
150
- stub_delete("/groups/3/members/1", "group_member_delete")
151
- @group = Gitlab.remove_group_member(3, 1)
152
- end
153
-
154
- it "should get the correct resource" do
155
- expect(a_delete("/groups/3/members/1")).to have_been_made
156
- end
157
-
158
- it "should return information about the group the member was removed from" do
159
- expect(@group.group_id).to eq(3)
160
- end
161
- end
162
-
163
- describe ".group_projects" do
164
- before do
165
- stub_get("/groups/4/projects", "group_projects")
166
- @projects = Gitlab.group_projects(4)
167
- end
168
-
169
- it "should get the list of projects" do
170
- expect(a_get("/groups/4/projects")).to have_been_made
171
- end
172
-
173
- it "should return a list of of projects under a group" do
174
- expect(@projects).to be_a Gitlab::PaginatedResponse
175
- expect(@projects.size).to eq(1)
176
- expect(@projects[0].name).to eq("Diaspora Client")
177
- end
178
- end
179
-
180
- describe ".group_search" do
181
- before do
182
- stub_get("/groups?search=Group", "group_search")
183
- @groups = Gitlab.group_search('Group')
184
- end
185
-
186
- it "should get the correct resource" do
187
- expect(a_get("/groups?search=Group")).to have_been_made
188
- end
189
-
190
- it "should return an array of groups found" do
191
- expect(@groups.first.id).to eq(5)
192
- expect(@groups.last.id).to eq(8)
193
- end
194
- end
195
- end
@@ -1,186 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gitlab::Client do
4
- describe ".issues" do
5
- context "with project ID passed" do
6
- before do
7
- stub_get("/projects/3/issues", "project_issues")
8
- @issues = Gitlab.issues(3)
9
- end
10
-
11
- it "should get the correct resource" do
12
- expect(a_get("/projects/3/issues")).to have_been_made
13
- end
14
-
15
- it "should return a paginated response of project's issues" do
16
- expect(@issues).to be_a Gitlab::PaginatedResponse
17
- expect(@issues.first.project_id).to eq(3)
18
- end
19
- end
20
-
21
- context 'with literal project ID passed' do
22
- before do
23
- stub_get("/projects/gitlab-org%2Fgitlab-ce/issues", "project_issues")
24
- @issues = Gitlab.issues('gitlab-org/gitlab-ce')
25
- end
26
-
27
- it "should get the correct resource" do
28
- expect(a_get("/projects/gitlab-org%2Fgitlab-ce/issues")).to have_been_made
29
- end
30
-
31
- it "should return a paginated response of project's issues" do
32
- expect(@issues).to be_a Gitlab::PaginatedResponse
33
- expect(@issues.first.project_id).to eq(3)
34
- end
35
- end
36
-
37
- context "without project ID passed" do
38
- before do
39
- stub_get("/issues", "issues")
40
- @issues = Gitlab.issues
41
- end
42
-
43
- it "should get the correct resource" do
44
- expect(a_get("/issues")).to have_been_made
45
- end
46
-
47
- it "should return a paginated response of user's issues" do
48
- expect(@issues).to be_a Gitlab::PaginatedResponse
49
- expect(@issues.first.closed).to be_falsey
50
- expect(@issues.first.author.name).to eq("John Smith")
51
- end
52
- end
53
- end
54
-
55
- describe ".issue" do
56
- before do
57
- stub_get("/projects/3/issues/33", "issue")
58
- @issue = Gitlab.issue(3, 33)
59
- end
60
-
61
- it "should get the correct resource" do
62
- expect(a_get("/projects/3/issues/33")).to have_been_made
63
- end
64
-
65
- it "should return information about an issue" do
66
- expect(@issue.project_id).to eq(3)
67
- expect(@issue.assignee.name).to eq("Jack Smith")
68
- end
69
- end
70
-
71
- describe ".create_issue" do
72
- before do
73
- stub_post("/projects/3/issues", "issue")
74
- @issue = Gitlab.create_issue(3, 'title')
75
- end
76
-
77
- it "should get the correct resource" do
78
- expect(a_post("/projects/3/issues").
79
- with(body: { title: 'title' })).to have_been_made
80
- end
81
-
82
- it "should return information about a created issue" do
83
- expect(@issue.project_id).to eq(3)
84
- expect(@issue.assignee.name).to eq("Jack Smith")
85
- end
86
- end
87
-
88
- describe ".edit_issue" do
89
- before do
90
- stub_put("/projects/3/issues/33", "issue")
91
- @issue = Gitlab.edit_issue(3, 33, title: 'title')
92
- end
93
-
94
- it "should get the correct resource" do
95
- expect(a_put("/projects/3/issues/33").
96
- with(body: { title: 'title' })).to have_been_made
97
- end
98
-
99
- it "should return information about an edited issue" do
100
- expect(@issue.project_id).to eq(3)
101
- expect(@issue.assignee.name).to eq("Jack Smith")
102
- end
103
- end
104
-
105
- describe ".close_issue" do
106
- before do
107
- stub_put("/projects/3/issues/33", "issue")
108
- @issue = Gitlab.close_issue(3, 33)
109
- end
110
-
111
- it "should get the correct resource" do
112
- expect(a_put("/projects/3/issues/33").
113
- with(body: { state_event: 'close' })).to have_been_made
114
- end
115
-
116
- it "should return information about an closed issue" do
117
- expect(@issue.project_id).to eq(3)
118
- expect(@issue.assignee.name).to eq("Jack Smith")
119
- end
120
- end
121
-
122
- describe ".reopen_issue" do
123
- before do
124
- stub_put("/projects/3/issues/33", "issue")
125
- @issue = Gitlab.reopen_issue(3, 33)
126
- end
127
-
128
- it "should get the correct resource" do
129
- expect(a_put("/projects/3/issues/33").
130
- with(body: { state_event: 'reopen' })).to have_been_made
131
- end
132
-
133
- it "should return information about an reopened issue" do
134
- expect(@issue.project_id).to eq(3)
135
- expect(@issue.assignee.name).to eq("Jack Smith")
136
- end
137
- end
138
-
139
- describe ".subscribe_to_issue" do
140
- before do
141
- stub_post("/projects/3/issues/33/subscribe", "issue")
142
- @issue = Gitlab.subscribe_to_issue(3, 33)
143
- end
144
-
145
- it "should get the correct resource" do
146
- expect(a_post("/projects/3/issues/33/subscribe")).to have_been_made
147
- end
148
-
149
- it "should return information about the subscribed issue" do
150
- expect(@issue.project_id).to eq(3)
151
- expect(@issue.assignee.name).to eq("Jack Smith")
152
- end
153
- end
154
-
155
- describe ".unsubscribe_from_issue" do
156
- before do
157
- stub_post("/projects/3/issues/33/unsubscribe", "issue")
158
- @issue = Gitlab.unsubscribe_from_issue(3, 33)
159
- end
160
-
161
- it "should get the correct resource" do
162
- expect(a_post("/projects/3/issues/33/unsubscribe")).to have_been_made
163
- end
164
-
165
- it "should return information about the unsubscribed issue" do
166
- expect(@issue.project_id).to eq(3)
167
- expect(@issue.assignee.name).to eq("Jack Smith")
168
- end
169
- end
170
-
171
- describe ".delete_issue" do
172
- before do
173
- stub_delete("/projects/3/issues/33", "issue")
174
- @issue = Gitlab.delete_issue(3, 33)
175
- end
176
-
177
- it "should get the correct resource" do
178
- expect(a_delete("/projects/3/issues/33")).to have_been_made
179
- end
180
-
181
- it "should return information about a deleted issue" do
182
- expect(@issue.project_id).to eq(3)
183
- expect(@issue.id).to eq(33)
184
- end
185
- end
186
- end
@@ -1,135 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gitlab::Client do
4
- describe '.jobs' do
5
- before do
6
- stub_get('/projects/1/jobs', 'jobs')
7
- @projects = Gitlab.jobs(1)
8
- end
9
-
10
- it 'should get the correct resource' do
11
- expect(a_get('/projects/1/jobs')).to have_been_made
12
- end
13
- end
14
-
15
- describe '.jobs - with scopes' do
16
- before do
17
- stub_get('/projects/1/jobs?scope[]=created&scope[]=running', 'jobs')
18
- @projects = Gitlab.jobs(1, scope: %w[created running])
19
- end
20
-
21
- it 'should get the correct resource' do
22
- expect(a_get('/projects/1/jobs?scope[]=created&scope[]=running')).to have_been_made
23
- end
24
- end
25
-
26
- describe '.pipeline_jobs' do
27
- before do
28
- stub_get('/projects/1/pipelines/1/jobs', 'pipeline_jobs')
29
- @projects = Gitlab.pipeline_jobs(1, 1)
30
- end
31
- it 'should get the correct resource' do
32
- expect(a_get('/projects/1/pipelines/1/jobs')).to have_been_made
33
- end
34
- end
35
-
36
- describe '.pipeline_jobs - with scope' do
37
- before do
38
- stub_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created', 'pipeline_jobs')
39
- @projects = Gitlab.pipeline_jobs(1, 1, scope: %w[running created])
40
- end
41
- it 'should get the correct resource' do
42
- expect(a_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created')).to have_been_made
43
- end
44
- end
45
-
46
- describe '.job' do
47
- before do
48
- stub_get('/projects/1/jobs/1', 'job')
49
- @projects = Gitlab.job(1, 1)
50
- end
51
- it 'should get the correct resource' do
52
- expect(a_get('/projects/1/jobs/1')).to have_been_made
53
- end
54
- end
55
-
56
- describe '.job_artifacts' do
57
- before do
58
- stub_get('/projects/1/jobs/1/artifacts', 'job')
59
- @projects = Gitlab.job_artifacts(1, 1)
60
- end
61
- it 'should get the correct resource' do
62
- expect(a_get('/projects/1/jobs/1/artifacts')).to have_been_made
63
- end
64
- end
65
-
66
- describe '.job_artifacts_download' do
67
- before do
68
- stub_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build', 'job')
69
- @projects = Gitlab.job_artifacts_download(1, 'master', 'Release Build')
70
- end
71
- it 'should get the correct resource' do
72
- expect(a_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build')).to have_been_made
73
- end
74
- end
75
-
76
- describe '.job_trace' do
77
- before do
78
- stub_get('/projects/1/jobs/1/trace', 'job_trace')
79
- @projects = Gitlab.job_trace(1, 1)
80
- end
81
- it 'should get the correct resource' do
82
- expect(a_get('/projects/1/jobs/1/trace')).to have_been_made
83
- end
84
- end
85
-
86
- describe '.job_cancel' do
87
- before do
88
- stub_post('/projects/1/jobs/1/cancel', 'job')
89
- @projects = Gitlab.job_cancel(1, 1)
90
- end
91
- it 'should get the correct resource' do
92
- expect(a_post('/projects/1/jobs/1/cancel')).to have_been_made
93
- end
94
- end
95
-
96
- describe '.job_retry' do
97
- before do
98
- stub_post('/projects/1/jobs/1/retry', 'job')
99
- @projects = Gitlab.job_retry(1, 1)
100
- end
101
- it 'should get the correct resource' do
102
- expect(a_post('/projects/1/jobs/1/retry')).to have_been_made
103
- end
104
- end
105
-
106
- describe '.job_erase' do
107
- before do
108
- stub_post('/projects/1/jobs/1/erase', 'job')
109
- @projects = Gitlab.job_erase(1, 1)
110
- end
111
- it 'should get the correct resource' do
112
- expect(a_post('/projects/1/jobs/1/erase')).to have_been_made
113
- end
114
- end
115
-
116
- describe '.job_play' do
117
- before do
118
- stub_post('/projects/1/jobs/1/play', 'job')
119
- @projects = Gitlab.job_play(1, 1)
120
- end
121
- it 'should get the correct resource' do
122
- expect(a_post('/projects/1/jobs/1/play')).to have_been_made
123
- end
124
- end
125
-
126
- describe '.job_artifacts_keep' do
127
- before do
128
- stub_post('/projects/1/jobs/1/artifacts/keep', 'job')
129
- @projects = Gitlab.job_artifacts_keep(1, 1)
130
- end
131
- it 'should get the correct resource' do
132
- expect(a_post('/projects/1/jobs/1/artifacts/keep')).to have_been_made
133
- end
134
- end
135
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gitlab::Client do
4
- describe ".key" do
5
- before do
6
- stub_get("/keys/1", "key")
7
- @key = Gitlab.key(1)
8
- end
9
-
10
- it "should get the correct resource" do
11
- expect(a_get("/keys/1")).to have_been_made
12
- end
13
-
14
- it "should return information about a key" do
15
- expect(@key.id).to eq(1)
16
- expect(@key.title).to eq("narkoz@helium")
17
- end
18
- end
19
- end
@@ -1,100 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gitlab::Client do
4
- describe ".labels" do
5
- before do
6
- stub_get("/projects/3/labels", "labels")
7
- @labels = Gitlab.labels(3)
8
- end
9
-
10
- it "should get the correct resource" do
11
- expect(a_get("/projects/3/labels")).to have_been_made
12
- end
13
-
14
- it "should return a paginated response of project's labels" do
15
- expect(@labels).to be_a Gitlab::PaginatedResponse
16
- expect(@labels.first.name).to eq("Backlog")
17
- end
18
- end
19
-
20
- describe ".delete" do
21
- before do
22
- stub_delete("/projects/3/labels", "label")
23
- @label = Gitlab.delete_label(3, "Backlog")
24
- end
25
-
26
- it "should get the correct resource" do
27
- expect(a_delete("/projects/3/labels").
28
- with(body: { name: 'Backlog' })).to have_been_made
29
- end
30
-
31
- it "should return information about a deleted snippet" do
32
- expect(@label.name).to eq("Backlog")
33
- end
34
- end
35
-
36
- describe ".edit_label" do
37
- before do
38
- stub_put("/projects/3/labels", "label")
39
- @label = Gitlab.edit_label(3, "TODO", new_name: 'Backlog')
40
- end
41
-
42
- it "should get the correct resource" do
43
- expect(a_put("/projects/3/labels").
44
- with(body: { name: 'TODO', new_name: "Backlog" })).to have_been_made
45
- end
46
-
47
- it "should return information about an edited label" do
48
- expect(@label.name).to eq("Backlog")
49
- end
50
- end
51
-
52
- describe ".create_label" do
53
- before do
54
- stub_post("/projects/3/labels", "label")
55
- @label = Gitlab.create_label(3, 'Backlog', '#DD10AA')
56
- end
57
-
58
- it "should get the correct resource" do
59
- expect(a_post("/projects/3/labels").
60
- with(body: { name: 'Backlog', color: '#DD10AA' })).to have_been_made
61
- end
62
-
63
- it "should return information about a created label" do
64
- expect(@label.name).to eq('Backlog')
65
- expect(@label.color).to eq('#DD10AA')
66
- end
67
- end
68
-
69
- describe ".subscribe_to_label" do
70
- before do
71
- stub_post("/projects/3/labels/Backlog/subscribe", "label")
72
- @label = Gitlab.subscribe_to_label(3, 'Backlog')
73
- end
74
-
75
- it "should get the correct resource" do
76
- expect(a_post("/projects/3/labels/Backlog/subscribe")).to have_been_made
77
- end
78
-
79
- it "should return information about the label subscribed to" do
80
- expect(@label.name).to eq('Backlog')
81
- expect(@label.subscribed).to eq(true)
82
- end
83
- end
84
-
85
- describe ".unsubscribe_from_label" do
86
- before do
87
- stub_post("/projects/3/labels/Backlog/unsubscribe", "label_unsubscribe")
88
- @label = Gitlab.unsubscribe_from_label(3, 'Backlog')
89
- end
90
-
91
- it "should get the correct resource" do
92
- expect(a_post("/projects/3/labels/Backlog/unsubscribe")).to have_been_made
93
- end
94
-
95
- it "should return information about the label subscribed to" do
96
- expect(@label.name).to eq('Backlog')
97
- expect(@label.subscribed).to eq(false)
98
- end
99
- end
100
- end