gitlab 4.4.0 → 4.5.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 (232) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -2
  3. data/gitlab.gemspec +3 -1
  4. data/lib/gitlab/client.rb +1 -0
  5. data/lib/gitlab/client/merge_request_approvals.rb +110 -0
  6. data/lib/gitlab/client/projects.rb +19 -9
  7. data/lib/gitlab/error.rb +10 -3
  8. data/lib/gitlab/version.rb +1 -1
  9. metadata +5 -444
  10. data/.dockerignore +0 -6
  11. data/.rubocop.yml +0 -33
  12. data/.travis.yml +0 -13
  13. data/Dockerfile +0 -8
  14. data/docker-compose.yml +0 -19
  15. data/docker.env +0 -2
  16. data/spec/fixtures/access_request.json +0 -8
  17. data/spec/fixtures/access_requests.json +0 -18
  18. data/spec/fixtures/approved_access_request.json +0 -8
  19. data/spec/fixtures/board_list.json +0 -1
  20. data/spec/fixtures/board_lists.json +0 -1
  21. data/spec/fixtures/boards.json +0 -1
  22. data/spec/fixtures/branch.json +0 -1
  23. data/spec/fixtures/branch_delete.json +0 -3
  24. data/spec/fixtures/branches.json +0 -1
  25. data/spec/fixtures/build.json +0 -38
  26. data/spec/fixtures/build_artifacts.json +0 -0
  27. data/spec/fixtures/build_cancel.json +0 -24
  28. data/spec/fixtures/build_erase.json +0 -24
  29. data/spec/fixtures/build_retry.json +0 -24
  30. data/spec/fixtures/builds.json +0 -78
  31. data/spec/fixtures/builds_commits.json +0 -64
  32. data/spec/fixtures/compare_merge_request_diff.json +0 -31
  33. data/spec/fixtures/default_approved_access_request.json +0 -8
  34. data/spec/fixtures/deployment.json +0 -57
  35. data/spec/fixtures/deployments.json +0 -116
  36. data/spec/fixtures/empty.json +0 -0
  37. data/spec/fixtures/environment.json +0 -6
  38. data/spec/fixtures/environments.json +0 -14
  39. data/spec/fixtures/error_already_exists.json +0 -1
  40. data/spec/fixtures/error_project_not_found.json +0 -1
  41. data/spec/fixtures/get_repository_file.json +0 -1
  42. data/spec/fixtures/group.json +0 -60
  43. data/spec/fixtures/group_create.json +0 -1
  44. data/spec/fixtures/group_create_with_description.json +0 -1
  45. data/spec/fixtures/group_delete.json +0 -1
  46. data/spec/fixtures/group_edit.json +0 -14
  47. data/spec/fixtures/group_member.json +0 -1
  48. data/spec/fixtures/group_member_delete.json +0 -1
  49. data/spec/fixtures/group_member_edit.json +0 -1
  50. data/spec/fixtures/group_members.json +0 -1
  51. data/spec/fixtures/group_milestone.json +0 -1
  52. data/spec/fixtures/group_milestone_issues.json +0 -1
  53. data/spec/fixtures/group_milestone_merge_requests.json +0 -1
  54. data/spec/fixtures/group_milestones.json +0 -1
  55. data/spec/fixtures/group_projects.json +0 -44
  56. data/spec/fixtures/group_search.json +0 -2
  57. data/spec/fixtures/group_subgroups.json +0 -16
  58. data/spec/fixtures/groups.json +0 -2
  59. data/spec/fixtures/issue.json +0 -1
  60. data/spec/fixtures/issue_award_emoji.json +0 -16
  61. data/spec/fixtures/issue_award_emojis.json +0 -34
  62. data/spec/fixtures/issues.json +0 -1
  63. data/spec/fixtures/job.json +0 -43
  64. data/spec/fixtures/job_trace.json +0 -1
  65. data/spec/fixtures/jobs.json +0 -91
  66. data/spec/fixtures/key.json +0 -1
  67. data/spec/fixtures/keys.json +0 -1
  68. data/spec/fixtures/label.json +0 -1
  69. data/spec/fixtures/label_unsubscribe.json +0 -1
  70. data/spec/fixtures/labels.json +0 -1
  71. data/spec/fixtures/merge_request.json +0 -1
  72. data/spec/fixtures/merge_request_award_emoji.json +0 -16
  73. data/spec/fixtures/merge_request_award_emojis.json +0 -34
  74. data/spec/fixtures/merge_request_changes.json +0 -1
  75. data/spec/fixtures/merge_request_closes_issues.json +0 -1
  76. data/spec/fixtures/merge_request_comment.json +0 -1
  77. data/spec/fixtures/merge_request_comments.json +0 -1
  78. data/spec/fixtures/merge_request_commits.json +0 -1
  79. data/spec/fixtures/merge_request_discussion.json +0 -39
  80. data/spec/fixtures/merge_request_discussion_note.json +0 -33
  81. data/spec/fixtures/merge_request_discussions.json +0 -41
  82. data/spec/fixtures/merge_requests.json +0 -1
  83. data/spec/fixtures/milestone.json +0 -1
  84. data/spec/fixtures/milestone_issues.json +0 -1
  85. data/spec/fixtures/milestone_merge_requests.json +0 -1
  86. data/spec/fixtures/milestones.json +0 -1
  87. data/spec/fixtures/namespaces.json +0 -1
  88. data/spec/fixtures/note.json +0 -1
  89. data/spec/fixtures/note_award_emoji.json +0 -16
  90. data/spec/fixtures/note_award_emojis.json +0 -18
  91. data/spec/fixtures/notes.json +0 -1
  92. data/spec/fixtures/pipeline.json +0 -23
  93. data/spec/fixtures/pipeline_cancel.json +0 -23
  94. data/spec/fixtures/pipeline_create.json +0 -23
  95. data/spec/fixtures/pipeline_jobs.json +0 -91
  96. data/spec/fixtures/pipeline_retry.json +0 -23
  97. data/spec/fixtures/pipeline_schedule.json +0 -32
  98. data/spec/fixtures/pipeline_schedule_create.json +0 -21
  99. data/spec/fixtures/pipeline_schedule_update.json +0 -26
  100. data/spec/fixtures/pipeline_schedule_variable.json +0 -5
  101. data/spec/fixtures/pipeline_schedule_variable_update.json +0 -5
  102. data/spec/fixtures/pipeline_schedules.json +0 -22
  103. data/spec/fixtures/pipelines.json +0 -48
  104. data/spec/fixtures/project.json +0 -1
  105. data/spec/fixtures/project_commit.json +0 -13
  106. data/spec/fixtures/project_commit_comment.json +0 -1
  107. data/spec/fixtures/project_commit_comments.json +0 -1
  108. data/spec/fixtures/project_commit_create.json +0 -22
  109. data/spec/fixtures/project_commit_diff.json +0 -10
  110. data/spec/fixtures/project_commit_merge_requests.json +0 -1
  111. data/spec/fixtures/project_commit_status.json +0 -42
  112. data/spec/fixtures/project_commits.json +0 -1
  113. data/spec/fixtures/project_edit.json +0 -21
  114. data/spec/fixtures/project_events.json +0 -81
  115. data/spec/fixtures/project_for_user.json +0 -1
  116. data/spec/fixtures/project_fork.json +0 -50
  117. data/spec/fixtures/project_fork_link.json +0 -1
  118. data/spec/fixtures/project_forked_for_user.json +0 -50
  119. data/spec/fixtures/project_forks.json +0 -50
  120. data/spec/fixtures/project_hook.json +0 -1
  121. data/spec/fixtures/project_hooks.json +0 -1
  122. data/spec/fixtures/project_issues.json +0 -1
  123. data/spec/fixtures/project_key.json +0 -6
  124. data/spec/fixtures/project_keys.json +0 -6
  125. data/spec/fixtures/project_runner_enable.json +0 -7
  126. data/spec/fixtures/project_runners.json +0 -16
  127. data/spec/fixtures/project_search.json +0 -1
  128. data/spec/fixtures/project_star.json +0 -44
  129. data/spec/fixtures/project_tag_annotated.json +0 -1
  130. data/spec/fixtures/project_tag_lightweight.json +0 -1
  131. data/spec/fixtures/project_tags.json +0 -1
  132. data/spec/fixtures/project_unstar.json +0 -44
  133. data/spec/fixtures/project_update_commit_status.json +0 -20
  134. data/spec/fixtures/projects.json +0 -1
  135. data/spec/fixtures/push_rule.json +0 -1
  136. data/spec/fixtures/raw_file.json +0 -2
  137. data/spec/fixtures/release_create.json +0 -1
  138. data/spec/fixtures/release_update.json +0 -1
  139. data/spec/fixtures/repository_file.json +0 -1
  140. data/spec/fixtures/run_trigger.json +0 -1
  141. data/spec/fixtures/runner.json +0 -26
  142. data/spec/fixtures/runner_delete.json +0 -7
  143. data/spec/fixtures/runner_edit.json +0 -26
  144. data/spec/fixtures/runner_jobs.json +0 -63
  145. data/spec/fixtures/runners.json +0 -16
  146. data/spec/fixtures/runners_all.json +0 -30
  147. data/spec/fixtures/service.json +0 -1
  148. data/spec/fixtures/session.json +0 -1
  149. data/spec/fixtures/shell_history.json +0 -2
  150. data/spec/fixtures/sidekiq_compound_metrics.json +0 -36
  151. data/spec/fixtures/sidekiq_job_stats.json +0 -7
  152. data/spec/fixtures/sidekiq_process_metrics.json +0 -25
  153. data/spec/fixtures/sidekiq_queue_metrics.json +0 -8
  154. data/spec/fixtures/snippet.json +0 -1
  155. data/spec/fixtures/snippet_award_emoji.json +0 -16
  156. data/spec/fixtures/snippet_award_emojis.json +0 -34
  157. data/spec/fixtures/snippet_content.json +0 -3
  158. data/spec/fixtures/snippets.json +0 -1
  159. data/spec/fixtures/system_hook.json +0 -1
  160. data/spec/fixtures/system_hooks.json +0 -1
  161. data/spec/fixtures/tag.json +0 -1
  162. data/spec/fixtures/tag_create.json +0 -1
  163. data/spec/fixtures/tag_create_with_description.json +0 -1
  164. data/spec/fixtures/tag_delete.json +0 -1
  165. data/spec/fixtures/tags.json +0 -1
  166. data/spec/fixtures/team_member.json +0 -1
  167. data/spec/fixtures/team_members.json +0 -1
  168. data/spec/fixtures/todo.json +0 -73
  169. data/spec/fixtures/todos.json +0 -148
  170. data/spec/fixtures/tree.json +0 -1
  171. data/spec/fixtures/trigger.json +0 -10
  172. data/spec/fixtures/triggers.json +0 -12
  173. data/spec/fixtures/user.json +0 -1
  174. data/spec/fixtures/user_block_unblock.json +0 -1
  175. data/spec/fixtures/user_contribution_events.json +0 -101
  176. data/spec/fixtures/user_email.json +0 -1
  177. data/spec/fixtures/user_emails.json +0 -1
  178. data/spec/fixtures/user_events.json +0 -40
  179. data/spec/fixtures/user_projects.json +0 -153
  180. data/spec/fixtures/user_search.json +0 -1
  181. data/spec/fixtures/users.json +0 -1
  182. data/spec/fixtures/variable.json +0 -4
  183. data/spec/fixtures/variables.json +0 -10
  184. data/spec/gitlab/api_spec.rb +0 -11
  185. data/spec/gitlab/cli_helpers_spec.rb +0 -56
  186. data/spec/gitlab/cli_spec.rb +0 -119
  187. data/spec/gitlab/client/access_requests_spec.rb +0 -141
  188. data/spec/gitlab/client/award_emojis_spec.rb +0 -391
  189. data/spec/gitlab/client/boards_spec.rb +0 -94
  190. data/spec/gitlab/client/branches_spec.rb +0 -118
  191. data/spec/gitlab/client/build_variables_spec.rb +0 -169
  192. data/spec/gitlab/client/builds_spec.rb +0 -148
  193. data/spec/gitlab/client/client_spec.rb +0 -11
  194. data/spec/gitlab/client/commits_spec.rb +0 -190
  195. data/spec/gitlab/client/deployments_spec.rb +0 -38
  196. data/spec/gitlab/client/environments_spec.rb +0 -132
  197. data/spec/gitlab/client/events_spec.rb +0 -48
  198. data/spec/gitlab/client/group_milestones_spec.rb +0 -98
  199. data/spec/gitlab/client/groups_spec.rb +0 -246
  200. data/spec/gitlab/client/issues_spec.rb +0 -285
  201. data/spec/gitlab/client/jobs_spec.rb +0 -135
  202. data/spec/gitlab/client/keys_spec.rb +0 -19
  203. data/spec/gitlab/client/labels_spec.rb +0 -100
  204. data/spec/gitlab/client/merge_requests_spec.rb +0 -351
  205. data/spec/gitlab/client/milestones_spec.rb +0 -98
  206. data/spec/gitlab/client/namespaces_spec.rb +0 -22
  207. data/spec/gitlab/client/notes_spec.rb +0 -333
  208. data/spec/gitlab/client/pipeline_schedules_spec.rb +0 -158
  209. data/spec/gitlab/client/pipeline_triggers_spec.rb +0 -157
  210. data/spec/gitlab/client/pipelines_spec.rb +0 -95
  211. data/spec/gitlab/client/projects_spec.rb +0 -630
  212. data/spec/gitlab/client/repositories_spec.rb +0 -94
  213. data/spec/gitlab/client/repository_files_spec.rb +0 -95
  214. data/spec/gitlab/client/runners_spec.rb +0 -193
  215. data/spec/gitlab/client/services_spec.rb +0 -55
  216. data/spec/gitlab/client/sidekiq_spec.rb +0 -64
  217. data/spec/gitlab/client/snippets_spec.rb +0 -100
  218. data/spec/gitlab/client/system_hooks_spec.rb +0 -69
  219. data/spec/gitlab/client/tags_spec.rb +0 -152
  220. data/spec/gitlab/client/todos_spec.rb +0 -45
  221. data/spec/gitlab/client/users_spec.rb +0 -418
  222. data/spec/gitlab/error_spec.rb +0 -72
  223. data/spec/gitlab/file_response_spec.rb +0 -33
  224. data/spec/gitlab/help_spec.rb +0 -46
  225. data/spec/gitlab/objectified_hash_spec.rb +0 -48
  226. data/spec/gitlab/page_links_spec.rb +0 -16
  227. data/spec/gitlab/paginated_response_spec.rb +0 -60
  228. data/spec/gitlab/request_spec.rb +0 -73
  229. data/spec/gitlab/shell_history_spec.rb +0 -53
  230. data/spec/gitlab/shell_spec.rb +0 -80
  231. data/spec/gitlab_spec.rb +0 -96
  232. data/spec/spec_helper.rb +0 -39
@@ -1,98 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gitlab::Client do
4
- describe ".milestones" do
5
- before do
6
- stub_get("/projects/3/milestones", "milestones")
7
- @milestones = Gitlab.milestones(3)
8
- end
9
-
10
- it "gets the correct resource" do
11
- expect(a_get("/projects/3/milestones")).to have_been_made
12
- end
13
-
14
- it "returns a paginated response of project's milestones" do
15
- expect(@milestones).to be_a Gitlab::PaginatedResponse
16
- expect(@milestones.first.project_id).to eq(3)
17
- end
18
- end
19
-
20
- describe ".milestone" do
21
- before do
22
- stub_get("/projects/3/milestones/1", "milestone")
23
- @milestone = Gitlab.milestone(3, 1)
24
- end
25
-
26
- it "gets the correct resource" do
27
- expect(a_get("/projects/3/milestones/1")).to have_been_made
28
- end
29
-
30
- it "returns information about a milestone" do
31
- expect(@milestone.project_id).to eq(3)
32
- end
33
- end
34
-
35
- describe ".milestone_issues" do
36
- before do
37
- stub_get("/projects/3/milestones/1/issues", "milestone_issues")
38
- @milestone_issues = Gitlab.milestone_issues(3, 1)
39
- end
40
-
41
- it "gets the correct resource" do
42
- expect(a_get("/projects/3/milestones/1/issues")).to have_been_made
43
- end
44
-
45
- it "returns a paginated response of milestone's issues" do
46
- expect(@milestone_issues).to be_a Gitlab::PaginatedResponse
47
- expect(@milestone_issues.first.milestone.id).to eq(1)
48
- end
49
- end
50
-
51
- describe ".milestone_merge_requests" do
52
- before do
53
- stub_get("/projects/3/milestones/1/merge_requests", "milestone_merge_requests")
54
- @milestone_merge_requests = Gitlab.milestone_merge_requests(3, 1)
55
- end
56
-
57
- it "gets the correct resource" do
58
- expect(a_get("/projects/3/milestones/1/merge_requests")).to have_been_made
59
- end
60
-
61
- it "returns a paginated response of milestone's merge_requests" do
62
- expect(@milestone_merge_requests).to be_a Gitlab::PaginatedResponse
63
- expect(@milestone_merge_requests.first.milestone.id).to eq(1)
64
- end
65
- end
66
-
67
- describe ".create_milestone" do
68
- before do
69
- stub_post("/projects/3/milestones", "milestone")
70
- @milestone = Gitlab.create_milestone(3, 'title')
71
- end
72
-
73
- it "gets the correct resource" do
74
- expect(a_post("/projects/3/milestones").
75
- with(body: { title: 'title' })).to have_been_made
76
- end
77
-
78
- it "returns information about a created milestone" do
79
- expect(@milestone.project_id).to eq(3)
80
- end
81
- end
82
-
83
- describe ".edit_milestone" do
84
- before do
85
- stub_put("/projects/3/milestones/33", "milestone")
86
- @milestone = Gitlab.edit_milestone(3, 33, title: 'title')
87
- end
88
-
89
- it "gets the correct resource" do
90
- expect(a_put("/projects/3/milestones/33").
91
- with(body: { title: 'title' })).to have_been_made
92
- end
93
-
94
- it "returns information about an edited milestone" do
95
- expect(@milestone.project_id).to eq(3)
96
- end
97
- end
98
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gitlab::Client do
4
- it { is_expected.to respond_to :namespaces }
5
-
6
- describe ".namespaces" do
7
- before do
8
- stub_get("/namespaces", "namespaces")
9
- @namespaces = Gitlab.namespaces
10
- end
11
-
12
- it "gets the correct resource" do
13
- expect(a_get("/namespaces")).to have_been_made
14
- end
15
-
16
- it "returns a paginated response of namespaces" do
17
- expect(@namespaces).to be_a Gitlab::PaginatedResponse
18
- expect(@namespaces.first.path).to eq("john")
19
- expect(@namespaces.first.kind).to eq("user")
20
- end
21
- end
22
- end
@@ -1,333 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gitlab::Client do
4
- describe "notes" do
5
- context "when wall notes" do
6
- before do
7
- stub_get("/projects/3/notes", "notes")
8
- @notes = Gitlab.notes(3)
9
- end
10
-
11
- it "gets the correct resource" do
12
- expect(a_get("/projects/3/notes")).to have_been_made
13
- end
14
-
15
- it "returns a paginated response of notes" do
16
- expect(@notes).to be_a Gitlab::PaginatedResponse
17
- expect(@notes.first.author.name).to eq("John Smith")
18
- end
19
- end
20
-
21
- context "when issue notes" do
22
- before do
23
- stub_get("/projects/3/issues/7/notes", "notes")
24
- @notes = Gitlab.issue_notes(3, 7)
25
- end
26
-
27
- it "gets the correct resource" do
28
- expect(a_get("/projects/3/issues/7/notes")).to have_been_made
29
- end
30
-
31
- it "returns a paginated response of notes" do
32
- expect(@notes).to be_a Gitlab::PaginatedResponse
33
- expect(@notes.first.author.name).to eq("John Smith")
34
- end
35
- end
36
-
37
- context "when snippet notes" do
38
- before do
39
- stub_get("/projects/3/snippets/7/notes", "notes")
40
- @notes = Gitlab.snippet_notes(3, 7)
41
- end
42
-
43
- it "gets the correct resource" do
44
- expect(a_get("/projects/3/snippets/7/notes")).to have_been_made
45
- end
46
-
47
- it "returns a paginated response of notes" do
48
- expect(@notes).to be_a Gitlab::PaginatedResponse
49
- expect(@notes.first.author.name).to eq("John Smith")
50
- end
51
- end
52
-
53
- context "when merge_request notes" do
54
- before do
55
- stub_get("/projects/3/merge_requests/7/notes", "notes")
56
- @notes = Gitlab.merge_request_notes(3, 7)
57
- end
58
-
59
- it "gets the correct resource" do
60
- expect(a_get("/projects/3/merge_requests/7/notes")).to have_been_made
61
- end
62
-
63
- it "returns a paginated response of notes" do
64
- expect(@notes).to be_a Gitlab::PaginatedResponse
65
- expect(@notes.first.author.name).to eq("John Smith")
66
- end
67
- end
68
- end
69
-
70
- describe "note" do
71
- context "when wall note" do
72
- before do
73
- stub_get("/projects/3/notes/1201", "note")
74
- @note = Gitlab.note(3, 1201)
75
- end
76
-
77
- it "gets the correct resource" do
78
- expect(a_get("/projects/3/notes/1201")).to have_been_made
79
- end
80
-
81
- it "returns information about a note" do
82
- expect(@note.body).to eq("The solution is rather tricky")
83
- expect(@note.author.name).to eq("John Smith")
84
- end
85
- end
86
-
87
- context "when issue note" do
88
- before do
89
- stub_get("/projects/3/issues/7/notes/1201", "note")
90
- @note = Gitlab.issue_note(3, 7, 1201)
91
- end
92
-
93
- it "gets the correct resource" do
94
- expect(a_get("/projects/3/issues/7/notes/1201")).to have_been_made
95
- end
96
-
97
- it "returns information about a note" do
98
- expect(@note.body).to eq("The solution is rather tricky")
99
- expect(@note.author.name).to eq("John Smith")
100
- end
101
- end
102
-
103
- context "when snippet note" do
104
- before do
105
- stub_get("/projects/3/snippets/7/notes/1201", "note")
106
- @note = Gitlab.snippet_note(3, 7, 1201)
107
- end
108
-
109
- it "gets the correct resource" do
110
- expect(a_get("/projects/3/snippets/7/notes/1201")).to have_been_made
111
- end
112
-
113
- it "returns information about a note" do
114
- expect(@note.body).to eq("The solution is rather tricky")
115
- expect(@note.author.name).to eq("John Smith")
116
- end
117
- end
118
-
119
- context "when merge request note" do
120
- before do
121
- stub_get("/projects/3/merge_requests/7/notes/1201", "note")
122
- @note = Gitlab.merge_request_note(3, 7, 1201)
123
- end
124
-
125
- it "gets the correct resource" do
126
- expect(a_get("/projects/3/merge_requests/7/notes/1201")).to have_been_made
127
- end
128
-
129
- it "returns information about a note" do
130
- expect(@note.body).to eq("The solution is rather tricky")
131
- expect(@note.author.name).to eq("John Smith")
132
- end
133
- end
134
- end
135
-
136
- describe "create note" do
137
- context "when wall note" do
138
- before do
139
- stub_post("/projects/3/notes", "note")
140
- @note = Gitlab.create_note(3, "The solution is rather tricky")
141
- end
142
-
143
- it "gets the correct resource" do
144
- expect(a_post("/projects/3/notes").
145
- with(body: { body: 'The solution is rather tricky' })).to have_been_made
146
- end
147
-
148
- it "returns information about a created note" do
149
- expect(@note.body).to eq("The solution is rather tricky")
150
- expect(@note.author.name).to eq("John Smith")
151
- end
152
- end
153
-
154
- context "when issue note" do
155
- before do
156
- stub_post("/projects/3/issues/7/notes", "note")
157
- @note = Gitlab.create_issue_note(3, 7, "The solution is rather tricky")
158
- end
159
-
160
- it "gets the correct resource" do
161
- expect(a_post("/projects/3/issues/7/notes").
162
- with(body: { body: 'The solution is rather tricky' })).to have_been_made
163
- end
164
-
165
- it "returns information about a created note" do
166
- expect(@note.body).to eq("The solution is rather tricky")
167
- expect(@note.author.name).to eq("John Smith")
168
- end
169
- end
170
-
171
- context "when snippet note" do
172
- before do
173
- stub_post("/projects/3/snippets/7/notes", "note")
174
- @note = Gitlab.create_snippet_note(3, 7, "The solution is rather tricky")
175
- end
176
-
177
- it "gets the correct resource" do
178
- expect(a_post("/projects/3/snippets/7/notes").
179
- with(body: { body: 'The solution is rather tricky' })).to have_been_made
180
- end
181
-
182
- it "returns information about a created note" do
183
- expect(@note.body).to eq("The solution is rather tricky")
184
- expect(@note.author.name).to eq("John Smith")
185
- end
186
- end
187
-
188
- context "when merge_request note" do
189
- before do
190
- stub_post("/projects/3/merge_requests/7/notes", "note")
191
- @note = Gitlab.create_merge_request_note(3, 7, "The solution is rather tricky")
192
- end
193
-
194
- it "gets the correct resource" do
195
- expect(a_post("/projects/3/merge_requests/7/notes").
196
- with(body: { body: 'The solution is rather tricky' })).to have_been_made
197
- end
198
-
199
- it "returns information about a created note" do
200
- expect(@note.body).to eq("The solution is rather tricky")
201
- expect(@note.author.name).to eq("John Smith")
202
- end
203
- end
204
- end
205
-
206
- describe "delete note" do
207
- context "when wall note" do
208
- before do
209
- stub_delete("/projects/3/notes/1201", "note")
210
- @note = Gitlab.delete_note(3, 1201)
211
- end
212
-
213
- it "gets the correct resource" do
214
- expect(a_delete("/projects/3/notes/1201")).to have_been_made
215
- end
216
-
217
- it "returns information about a deleted note" do
218
- expect(@note.id).to eq(1201)
219
- end
220
- end
221
-
222
- context "when issue note" do
223
- before do
224
- stub_delete("/projects/3/issues/7/notes/1201", "note")
225
- @note = Gitlab.delete_issue_note(3, 7, 1201)
226
- end
227
-
228
- it "gets the correct resource" do
229
- expect(a_delete("/projects/3/issues/7/notes/1201")).to have_been_made
230
- end
231
-
232
- it "returns information about a deleted issue note" do
233
- expect(@note.id).to eq(1201)
234
- end
235
- end
236
-
237
- context "when snippet note" do
238
- before do
239
- stub_delete("/projects/3/snippets/7/notes/1201", "note")
240
- @note = Gitlab.delete_snippet_note(3, 7, 1201)
241
- end
242
-
243
- it "gets the correct resource" do
244
- expect(a_delete("/projects/3/snippets/7/notes/1201")).to have_been_made
245
- end
246
-
247
- it "returns information about a deleted snippet note" do
248
- expect(@note.id).to eq(1201)
249
- end
250
- end
251
-
252
- context "when merge request note" do
253
- before do
254
- stub_delete("/projects/3/merge_requests/7/notes/1201", "note")
255
- @note = Gitlab.delete_merge_request_note(3, 7, 1201)
256
- end
257
-
258
- it "gets the correct resource" do
259
- expect(a_delete("/projects/3/merge_requests/7/notes/1201")).to have_been_made
260
- end
261
-
262
- it "returns information about a deleted merge request note" do
263
- expect(@note.id).to eq(1201)
264
- end
265
- end
266
- end
267
-
268
- describe "modify note" do
269
- context "when wall note" do
270
- before do
271
- stub_put("/projects/3/notes/1201", "note")
272
- @note = Gitlab.edit_note(3, 1201, "edited wall note content")
273
- end
274
-
275
- it "gets the correct resource" do
276
- expect(a_put("/projects/3/notes/1201").
277
- with(body: {body: 'edited wall note content'})).to have_been_made
278
- end
279
-
280
- it "returns information about a modified note" do
281
- expect(@note.id).to eq(1201)
282
- end
283
- end
284
-
285
- context "when issue note" do
286
- before do
287
- stub_put("/projects/3/issues/7/notes/1201", "note")
288
- @note = Gitlab.edit_issue_note(3, 7, 1201, "edited issue note content")
289
- end
290
-
291
- it "gets the correct resource" do
292
- expect(a_put("/projects/3/issues/7/notes/1201").
293
- with(body: {body: 'edited issue note content'})).to have_been_made
294
- end
295
-
296
- it "returns information about a modified issue note" do
297
- expect(@note.id).to eq(1201)
298
- end
299
- end
300
-
301
- context "when snippet note" do
302
- before do
303
- stub_put("/projects/3/snippets/7/notes/1201", "note")
304
- @note = Gitlab.edit_snippet_note(3, 7, 1201, "edited snippet note content")
305
- end
306
-
307
- it "gets the correct resource" do
308
- expect(a_put("/projects/3/snippets/7/notes/1201").
309
- with(body: {body: 'edited snippet note content'})).to have_been_made
310
- end
311
-
312
- it "returns information about a modified snippet note" do
313
- expect(@note.id).to eq(1201)
314
- end
315
- end
316
-
317
- context "when merge request note" do
318
- before do
319
- stub_put("/projects/3/merge_requests/7/notes/1201", "note")
320
- @note = Gitlab.edit_merge_request_note(3, 7, 1201, "edited merge request note content")
321
- end
322
-
323
- it "gets the correct resource" do
324
- expect(a_put("/projects/3/merge_requests/7/notes/1201").
325
- with(body: {body: 'edited merge request note content'})).to have_been_made
326
- end
327
-
328
- it "returns information about a modified request note" do
329
- expect(@note.id).to eq(1201)
330
- end
331
- end
332
- end
333
- end