gitlab 4.4.0 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -2
- data/gitlab.gemspec +3 -1
- data/lib/gitlab/client.rb +1 -0
- data/lib/gitlab/client/merge_request_approvals.rb +110 -0
- data/lib/gitlab/client/projects.rb +19 -9
- data/lib/gitlab/error.rb +10 -3
- data/lib/gitlab/version.rb +1 -1
- metadata +5 -444
- data/.dockerignore +0 -6
- data/.rubocop.yml +0 -33
- data/.travis.yml +0 -13
- data/Dockerfile +0 -8
- data/docker-compose.yml +0 -19
- data/docker.env +0 -2
- data/spec/fixtures/access_request.json +0 -8
- data/spec/fixtures/access_requests.json +0 -18
- data/spec/fixtures/approved_access_request.json +0 -8
- data/spec/fixtures/board_list.json +0 -1
- data/spec/fixtures/board_lists.json +0 -1
- data/spec/fixtures/boards.json +0 -1
- data/spec/fixtures/branch.json +0 -1
- data/spec/fixtures/branch_delete.json +0 -3
- data/spec/fixtures/branches.json +0 -1
- data/spec/fixtures/build.json +0 -38
- data/spec/fixtures/build_artifacts.json +0 -0
- data/spec/fixtures/build_cancel.json +0 -24
- data/spec/fixtures/build_erase.json +0 -24
- data/spec/fixtures/build_retry.json +0 -24
- data/spec/fixtures/builds.json +0 -78
- data/spec/fixtures/builds_commits.json +0 -64
- data/spec/fixtures/compare_merge_request_diff.json +0 -31
- data/spec/fixtures/default_approved_access_request.json +0 -8
- data/spec/fixtures/deployment.json +0 -57
- data/spec/fixtures/deployments.json +0 -116
- data/spec/fixtures/empty.json +0 -0
- data/spec/fixtures/environment.json +0 -6
- data/spec/fixtures/environments.json +0 -14
- data/spec/fixtures/error_already_exists.json +0 -1
- data/spec/fixtures/error_project_not_found.json +0 -1
- data/spec/fixtures/get_repository_file.json +0 -1
- data/spec/fixtures/group.json +0 -60
- data/spec/fixtures/group_create.json +0 -1
- data/spec/fixtures/group_create_with_description.json +0 -1
- data/spec/fixtures/group_delete.json +0 -1
- data/spec/fixtures/group_edit.json +0 -14
- data/spec/fixtures/group_member.json +0 -1
- data/spec/fixtures/group_member_delete.json +0 -1
- data/spec/fixtures/group_member_edit.json +0 -1
- data/spec/fixtures/group_members.json +0 -1
- data/spec/fixtures/group_milestone.json +0 -1
- data/spec/fixtures/group_milestone_issues.json +0 -1
- data/spec/fixtures/group_milestone_merge_requests.json +0 -1
- data/spec/fixtures/group_milestones.json +0 -1
- data/spec/fixtures/group_projects.json +0 -44
- data/spec/fixtures/group_search.json +0 -2
- data/spec/fixtures/group_subgroups.json +0 -16
- data/spec/fixtures/groups.json +0 -2
- data/spec/fixtures/issue.json +0 -1
- data/spec/fixtures/issue_award_emoji.json +0 -16
- data/spec/fixtures/issue_award_emojis.json +0 -34
- data/spec/fixtures/issues.json +0 -1
- data/spec/fixtures/job.json +0 -43
- data/spec/fixtures/job_trace.json +0 -1
- data/spec/fixtures/jobs.json +0 -91
- data/spec/fixtures/key.json +0 -1
- data/spec/fixtures/keys.json +0 -1
- data/spec/fixtures/label.json +0 -1
- data/spec/fixtures/label_unsubscribe.json +0 -1
- data/spec/fixtures/labels.json +0 -1
- data/spec/fixtures/merge_request.json +0 -1
- data/spec/fixtures/merge_request_award_emoji.json +0 -16
- data/spec/fixtures/merge_request_award_emojis.json +0 -34
- data/spec/fixtures/merge_request_changes.json +0 -1
- data/spec/fixtures/merge_request_closes_issues.json +0 -1
- data/spec/fixtures/merge_request_comment.json +0 -1
- data/spec/fixtures/merge_request_comments.json +0 -1
- data/spec/fixtures/merge_request_commits.json +0 -1
- data/spec/fixtures/merge_request_discussion.json +0 -39
- data/spec/fixtures/merge_request_discussion_note.json +0 -33
- data/spec/fixtures/merge_request_discussions.json +0 -41
- data/spec/fixtures/merge_requests.json +0 -1
- data/spec/fixtures/milestone.json +0 -1
- data/spec/fixtures/milestone_issues.json +0 -1
- data/spec/fixtures/milestone_merge_requests.json +0 -1
- data/spec/fixtures/milestones.json +0 -1
- data/spec/fixtures/namespaces.json +0 -1
- data/spec/fixtures/note.json +0 -1
- data/spec/fixtures/note_award_emoji.json +0 -16
- data/spec/fixtures/note_award_emojis.json +0 -18
- data/spec/fixtures/notes.json +0 -1
- data/spec/fixtures/pipeline.json +0 -23
- data/spec/fixtures/pipeline_cancel.json +0 -23
- data/spec/fixtures/pipeline_create.json +0 -23
- data/spec/fixtures/pipeline_jobs.json +0 -91
- data/spec/fixtures/pipeline_retry.json +0 -23
- data/spec/fixtures/pipeline_schedule.json +0 -32
- data/spec/fixtures/pipeline_schedule_create.json +0 -21
- data/spec/fixtures/pipeline_schedule_update.json +0 -26
- data/spec/fixtures/pipeline_schedule_variable.json +0 -5
- data/spec/fixtures/pipeline_schedule_variable_update.json +0 -5
- data/spec/fixtures/pipeline_schedules.json +0 -22
- data/spec/fixtures/pipelines.json +0 -48
- data/spec/fixtures/project.json +0 -1
- data/spec/fixtures/project_commit.json +0 -13
- data/spec/fixtures/project_commit_comment.json +0 -1
- data/spec/fixtures/project_commit_comments.json +0 -1
- data/spec/fixtures/project_commit_create.json +0 -22
- data/spec/fixtures/project_commit_diff.json +0 -10
- data/spec/fixtures/project_commit_merge_requests.json +0 -1
- data/spec/fixtures/project_commit_status.json +0 -42
- data/spec/fixtures/project_commits.json +0 -1
- data/spec/fixtures/project_edit.json +0 -21
- data/spec/fixtures/project_events.json +0 -81
- data/spec/fixtures/project_for_user.json +0 -1
- data/spec/fixtures/project_fork.json +0 -50
- data/spec/fixtures/project_fork_link.json +0 -1
- data/spec/fixtures/project_forked_for_user.json +0 -50
- data/spec/fixtures/project_forks.json +0 -50
- data/spec/fixtures/project_hook.json +0 -1
- data/spec/fixtures/project_hooks.json +0 -1
- data/spec/fixtures/project_issues.json +0 -1
- data/spec/fixtures/project_key.json +0 -6
- data/spec/fixtures/project_keys.json +0 -6
- data/spec/fixtures/project_runner_enable.json +0 -7
- data/spec/fixtures/project_runners.json +0 -16
- data/spec/fixtures/project_search.json +0 -1
- data/spec/fixtures/project_star.json +0 -44
- data/spec/fixtures/project_tag_annotated.json +0 -1
- data/spec/fixtures/project_tag_lightweight.json +0 -1
- data/spec/fixtures/project_tags.json +0 -1
- data/spec/fixtures/project_unstar.json +0 -44
- data/spec/fixtures/project_update_commit_status.json +0 -20
- data/spec/fixtures/projects.json +0 -1
- data/spec/fixtures/push_rule.json +0 -1
- data/spec/fixtures/raw_file.json +0 -2
- data/spec/fixtures/release_create.json +0 -1
- data/spec/fixtures/release_update.json +0 -1
- data/spec/fixtures/repository_file.json +0 -1
- data/spec/fixtures/run_trigger.json +0 -1
- data/spec/fixtures/runner.json +0 -26
- data/spec/fixtures/runner_delete.json +0 -7
- data/spec/fixtures/runner_edit.json +0 -26
- data/spec/fixtures/runner_jobs.json +0 -63
- data/spec/fixtures/runners.json +0 -16
- data/spec/fixtures/runners_all.json +0 -30
- data/spec/fixtures/service.json +0 -1
- data/spec/fixtures/session.json +0 -1
- data/spec/fixtures/shell_history.json +0 -2
- data/spec/fixtures/sidekiq_compound_metrics.json +0 -36
- data/spec/fixtures/sidekiq_job_stats.json +0 -7
- data/spec/fixtures/sidekiq_process_metrics.json +0 -25
- data/spec/fixtures/sidekiq_queue_metrics.json +0 -8
- data/spec/fixtures/snippet.json +0 -1
- data/spec/fixtures/snippet_award_emoji.json +0 -16
- data/spec/fixtures/snippet_award_emojis.json +0 -34
- data/spec/fixtures/snippet_content.json +0 -3
- data/spec/fixtures/snippets.json +0 -1
- data/spec/fixtures/system_hook.json +0 -1
- data/spec/fixtures/system_hooks.json +0 -1
- data/spec/fixtures/tag.json +0 -1
- data/spec/fixtures/tag_create.json +0 -1
- data/spec/fixtures/tag_create_with_description.json +0 -1
- data/spec/fixtures/tag_delete.json +0 -1
- data/spec/fixtures/tags.json +0 -1
- data/spec/fixtures/team_member.json +0 -1
- data/spec/fixtures/team_members.json +0 -1
- data/spec/fixtures/todo.json +0 -73
- data/spec/fixtures/todos.json +0 -148
- data/spec/fixtures/tree.json +0 -1
- data/spec/fixtures/trigger.json +0 -10
- data/spec/fixtures/triggers.json +0 -12
- data/spec/fixtures/user.json +0 -1
- data/spec/fixtures/user_block_unblock.json +0 -1
- data/spec/fixtures/user_contribution_events.json +0 -101
- data/spec/fixtures/user_email.json +0 -1
- data/spec/fixtures/user_emails.json +0 -1
- data/spec/fixtures/user_events.json +0 -40
- data/spec/fixtures/user_projects.json +0 -153
- data/spec/fixtures/user_search.json +0 -1
- data/spec/fixtures/users.json +0 -1
- data/spec/fixtures/variable.json +0 -4
- data/spec/fixtures/variables.json +0 -10
- data/spec/gitlab/api_spec.rb +0 -11
- data/spec/gitlab/cli_helpers_spec.rb +0 -56
- data/spec/gitlab/cli_spec.rb +0 -119
- data/spec/gitlab/client/access_requests_spec.rb +0 -141
- data/spec/gitlab/client/award_emojis_spec.rb +0 -391
- data/spec/gitlab/client/boards_spec.rb +0 -94
- data/spec/gitlab/client/branches_spec.rb +0 -118
- data/spec/gitlab/client/build_variables_spec.rb +0 -169
- data/spec/gitlab/client/builds_spec.rb +0 -148
- data/spec/gitlab/client/client_spec.rb +0 -11
- data/spec/gitlab/client/commits_spec.rb +0 -190
- data/spec/gitlab/client/deployments_spec.rb +0 -38
- data/spec/gitlab/client/environments_spec.rb +0 -132
- data/spec/gitlab/client/events_spec.rb +0 -48
- data/spec/gitlab/client/group_milestones_spec.rb +0 -98
- data/spec/gitlab/client/groups_spec.rb +0 -246
- data/spec/gitlab/client/issues_spec.rb +0 -285
- data/spec/gitlab/client/jobs_spec.rb +0 -135
- data/spec/gitlab/client/keys_spec.rb +0 -19
- data/spec/gitlab/client/labels_spec.rb +0 -100
- data/spec/gitlab/client/merge_requests_spec.rb +0 -351
- data/spec/gitlab/client/milestones_spec.rb +0 -98
- data/spec/gitlab/client/namespaces_spec.rb +0 -22
- data/spec/gitlab/client/notes_spec.rb +0 -333
- data/spec/gitlab/client/pipeline_schedules_spec.rb +0 -158
- data/spec/gitlab/client/pipeline_triggers_spec.rb +0 -157
- data/spec/gitlab/client/pipelines_spec.rb +0 -95
- data/spec/gitlab/client/projects_spec.rb +0 -630
- data/spec/gitlab/client/repositories_spec.rb +0 -94
- data/spec/gitlab/client/repository_files_spec.rb +0 -95
- data/spec/gitlab/client/runners_spec.rb +0 -193
- data/spec/gitlab/client/services_spec.rb +0 -55
- data/spec/gitlab/client/sidekiq_spec.rb +0 -64
- data/spec/gitlab/client/snippets_spec.rb +0 -100
- data/spec/gitlab/client/system_hooks_spec.rb +0 -69
- data/spec/gitlab/client/tags_spec.rb +0 -152
- data/spec/gitlab/client/todos_spec.rb +0 -45
- data/spec/gitlab/client/users_spec.rb +0 -418
- data/spec/gitlab/error_spec.rb +0 -72
- data/spec/gitlab/file_response_spec.rb +0 -33
- data/spec/gitlab/help_spec.rb +0 -46
- data/spec/gitlab/objectified_hash_spec.rb +0 -48
- data/spec/gitlab/page_links_spec.rb +0 -16
- data/spec/gitlab/paginated_response_spec.rb +0 -60
- data/spec/gitlab/request_spec.rb +0 -73
- data/spec/gitlab/shell_history_spec.rb +0 -53
- data/spec/gitlab/shell_spec.rb +0 -80
- data/spec/gitlab_spec.rb +0 -96
- data/spec/spec_helper.rb +0 -39
@@ -1,246 +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 "gets 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 "returns 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 "gets 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 "returns 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 "gets 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 "returns 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 "gets the correct resource" do
|
68
|
-
expect(a_delete("/groups/42")).to have_been_made
|
69
|
-
end
|
70
|
-
|
71
|
-
it "returns 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 "posts 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 "returns 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 "gets the correct resource" do
|
106
|
-
expect(a_get("/groups/3/members")).to have_been_made
|
107
|
-
end
|
108
|
-
|
109
|
-
it "returns information about a group's 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 ".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
|
-
|
133
|
-
describe ".add_group_member" do
|
134
|
-
before do
|
135
|
-
stub_post("/groups/3/members", "group_member")
|
136
|
-
@member = Gitlab.add_group_member(3, 1, 40)
|
137
|
-
end
|
138
|
-
|
139
|
-
it "gets the correct resource" do
|
140
|
-
expect(a_post("/groups/3/members").
|
141
|
-
with(body: { user_id: '1', access_level: '40' })).to have_been_made
|
142
|
-
end
|
143
|
-
|
144
|
-
it "returns information about the added member" do
|
145
|
-
expect(@member.name).to eq("John Smith")
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
describe ".edit_group_member" do
|
150
|
-
before do
|
151
|
-
stub_put("/groups/3/members/1", "group_member_edit")
|
152
|
-
@member = Gitlab.edit_group_member(3, 1, 50)
|
153
|
-
end
|
154
|
-
|
155
|
-
it "gets the correct resource" do
|
156
|
-
expect(a_put("/groups/3/members/1")
|
157
|
-
.with(body: { access_level: '50'})).to have_been_made
|
158
|
-
end
|
159
|
-
|
160
|
-
it "returns information about the edited member" do
|
161
|
-
expect(@member.access_level).to eq(50)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
describe ".remove_group_member" do
|
166
|
-
before do
|
167
|
-
stub_delete("/groups/3/members/1", "group_member_delete")
|
168
|
-
@group = Gitlab.remove_group_member(3, 1)
|
169
|
-
end
|
170
|
-
|
171
|
-
it "gets the correct resource" do
|
172
|
-
expect(a_delete("/groups/3/members/1")).to have_been_made
|
173
|
-
end
|
174
|
-
|
175
|
-
it "returns information about the group the member was removed from" do
|
176
|
-
expect(@group.group_id).to eq(3)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
describe ".group_projects" do
|
181
|
-
before do
|
182
|
-
stub_get("/groups/4/projects", "group_projects")
|
183
|
-
@projects = Gitlab.group_projects(4)
|
184
|
-
end
|
185
|
-
|
186
|
-
it "gets the list of projects" do
|
187
|
-
expect(a_get("/groups/4/projects")).to have_been_made
|
188
|
-
end
|
189
|
-
|
190
|
-
it "returns a list of of projects under a group" do
|
191
|
-
expect(@projects).to be_a Gitlab::PaginatedResponse
|
192
|
-
expect(@projects.size).to eq(1)
|
193
|
-
expect(@projects[0].name).to eq("Diaspora Client")
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
describe ".group_search" do
|
198
|
-
before do
|
199
|
-
stub_get("/groups?search=Group", "group_search")
|
200
|
-
@groups = Gitlab.group_search('Group')
|
201
|
-
end
|
202
|
-
|
203
|
-
it "gets the correct resource" do
|
204
|
-
expect(a_get("/groups?search=Group")).to have_been_made
|
205
|
-
end
|
206
|
-
|
207
|
-
it "returns an array of groups found" do
|
208
|
-
expect(@groups.first.id).to eq(5)
|
209
|
-
expect(@groups.last.id).to eq(8)
|
210
|
-
end
|
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
|
246
|
-
end
|
@@ -1,285 +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 "gets the correct resource" do
|
12
|
-
expect(a_get("/projects/3/issues")).to have_been_made
|
13
|
-
end
|
14
|
-
|
15
|
-
it "returns 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 "gets the correct resource" do
|
28
|
-
expect(a_get("/projects/gitlab-org%2Fgitlab-ce/issues")).to have_been_made
|
29
|
-
end
|
30
|
-
|
31
|
-
it "returns 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 "gets the correct resource" do
|
44
|
-
expect(a_get("/issues")).to have_been_made
|
45
|
-
end
|
46
|
-
|
47
|
-
it "returns 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 "gets the correct resource" do
|
62
|
-
expect(a_get("/projects/3/issues/33")).to have_been_made
|
63
|
-
end
|
64
|
-
|
65
|
-
it "returns 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 "gets 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 "returns 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 "gets 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 "returns 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 "gets 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 "returns 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 "gets 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 "returns 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 "gets the correct resource" do
|
146
|
-
expect(a_post("/projects/3/issues/33/subscribe")).to have_been_made
|
147
|
-
end
|
148
|
-
|
149
|
-
it "returns 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 "gets the correct resource" do
|
162
|
-
expect(a_post("/projects/3/issues/33/unsubscribe")).to have_been_made
|
163
|
-
end
|
164
|
-
|
165
|
-
it "returns 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 "gets the correct resource" do
|
178
|
-
expect(a_delete("/projects/3/issues/33")).to have_been_made
|
179
|
-
end
|
180
|
-
|
181
|
-
it "returns 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
|
-
|
187
|
-
describe ".move_issue" do
|
188
|
-
before do
|
189
|
-
stub_post("/projects/3/issues/33/move", "issue")
|
190
|
-
@issue = Gitlab.move_issue(3, 33, to_project_id: '4')
|
191
|
-
end
|
192
|
-
|
193
|
-
it "gets the correct resource" do
|
194
|
-
expect(a_post("/projects/3/issues/33/move").
|
195
|
-
with(body: { to_project_id: '4' })).to have_been_made
|
196
|
-
end
|
197
|
-
|
198
|
-
it "returns information about the moved issue" do
|
199
|
-
expect(@issue.project_id).to eq(3)
|
200
|
-
expect(@issue.assignee.name).to eq("Jack Smith")
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
describe ".estimate_time_of_issue" do
|
205
|
-
before do
|
206
|
-
stub_post("/projects/3/issues/33/time_estimate", "issue")
|
207
|
-
@issue = Gitlab.estimate_time_of_issue(3, 33, '3h30m')
|
208
|
-
end
|
209
|
-
|
210
|
-
it "gets the correct resource" do
|
211
|
-
expect(a_post("/projects/3/issues/33/time_estimate").
|
212
|
-
with(body: { duration: '3h30m' })).to have_been_made
|
213
|
-
end
|
214
|
-
|
215
|
-
it "returns information about the estimated issue" do
|
216
|
-
expect(@issue.project_id).to eq(3)
|
217
|
-
expect(@issue.assignee.name).to eq("Jack Smith")
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
describe ".reset_time_estimate_of_issue" do
|
222
|
-
before do
|
223
|
-
stub_post("/projects/3/issues/33/reset_time_estimate", "issue")
|
224
|
-
@issue = Gitlab.reset_time_estimate_of_issue(3, 33)
|
225
|
-
end
|
226
|
-
|
227
|
-
it "gets the correct resource" do
|
228
|
-
expect(a_post("/projects/3/issues/33/reset_time_estimate")).to have_been_made
|
229
|
-
end
|
230
|
-
|
231
|
-
it "returns information about the estimated issue" do
|
232
|
-
expect(@issue.project_id).to eq(3)
|
233
|
-
expect(@issue.assignee.name).to eq("Jack Smith")
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
describe ".add_time_spent_on_issue" do
|
238
|
-
before do
|
239
|
-
stub_post("/projects/3/issues/33/add_spent_time", "issue")
|
240
|
-
@issue = Gitlab.add_time_spent_on_issue(3, 33, '3h30m')
|
241
|
-
end
|
242
|
-
|
243
|
-
it "gets the correct resource" do
|
244
|
-
expect(a_post("/projects/3/issues/33/add_spent_time").
|
245
|
-
with(body: { duration: '3h30m' })).to have_been_made
|
246
|
-
end
|
247
|
-
|
248
|
-
it "returns information about the estimated issue" do
|
249
|
-
expect(@issue.project_id).to eq(3)
|
250
|
-
expect(@issue.assignee.name).to eq("Jack Smith")
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
describe ".reset_time_spent_on_issue" do
|
255
|
-
before do
|
256
|
-
stub_post("/projects/3/issues/33/reset_spent_time", "issue")
|
257
|
-
@issue = Gitlab.reset_time_spent_on_issue(3, 33)
|
258
|
-
end
|
259
|
-
|
260
|
-
it "gets the correct resource" do
|
261
|
-
expect(a_post("/projects/3/issues/33/reset_spent_time")).to have_been_made
|
262
|
-
end
|
263
|
-
|
264
|
-
it "returns information about the estimated issue" do
|
265
|
-
expect(@issue.project_id).to eq(3)
|
266
|
-
expect(@issue.assignee.name).to eq("Jack Smith")
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
describe ".time_stats_for_issue" do
|
271
|
-
before do
|
272
|
-
stub_get("/projects/3/issues/33/time_stats", "issue")
|
273
|
-
@issue = Gitlab.time_stats_for_issue(3, 33)
|
274
|
-
end
|
275
|
-
|
276
|
-
it "gets the correct resource" do
|
277
|
-
expect(a_get("/projects/3/issues/33/time_stats")).to have_been_made
|
278
|
-
end
|
279
|
-
|
280
|
-
it "returns information about the issue" do
|
281
|
-
expect(@issue.project_id).to eq(3)
|
282
|
-
expect(@issue.assignee.name).to eq("Jack Smith")
|
283
|
-
end
|
284
|
-
end
|
285
|
-
end
|