gitlab 3.0.0 → 4.0.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.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.travis.yml +6 -2
- data/CHANGELOG.md +244 -0
- data/CONTRIBUTING.md +195 -0
- data/LICENSE.txt +1 -1
- data/README.md +122 -10
- data/Rakefile +1 -1
- data/bin/console +10 -0
- data/bin/setup +6 -0
- data/exe/gitlab +7 -0
- data/gitlab.gemspec +9 -3
- data/lib/gitlab.rb +18 -2
- data/lib/gitlab/api.rb +6 -4
- data/lib/gitlab/cli.rb +89 -0
- data/lib/gitlab/cli_helpers.rb +241 -0
- data/lib/gitlab/client.rb +42 -6
- data/lib/gitlab/client/branches.rb +91 -0
- data/lib/gitlab/client/build_triggers.rb +51 -0
- data/lib/gitlab/client/build_variables.rb +66 -0
- data/lib/gitlab/client/builds.rb +106 -0
- data/lib/gitlab/client/commits.rb +146 -0
- data/lib/gitlab/client/groups.rb +66 -10
- data/lib/gitlab/client/issues.rb +61 -16
- data/lib/gitlab/client/labels.rb +57 -0
- data/lib/gitlab/client/merge_requests.rb +137 -26
- data/lib/gitlab/client/milestones.rb +44 -9
- data/lib/gitlab/client/namespaces.rb +20 -0
- data/lib/gitlab/client/notes.rb +71 -16
- data/lib/gitlab/client/pipelines.rb +68 -0
- data/lib/gitlab/client/projects.rb +236 -27
- data/lib/gitlab/client/repositories.rb +39 -45
- data/lib/gitlab/client/repository_files.rb +107 -0
- data/lib/gitlab/client/runners.rb +115 -0
- data/lib/gitlab/client/services.rb +50 -0
- data/lib/gitlab/client/snippets.rb +26 -21
- data/lib/gitlab/client/system_hooks.rb +59 -0
- data/lib/gitlab/client/tags.rb +96 -0
- data/lib/gitlab/client/users.rb +151 -7
- data/lib/gitlab/configuration.rb +20 -4
- data/lib/gitlab/error.rb +55 -12
- data/lib/gitlab/file_response.rb +46 -0
- data/lib/gitlab/help.rb +95 -0
- data/lib/gitlab/objectified_hash.rb +19 -3
- data/lib/gitlab/page_links.rb +33 -0
- data/lib/gitlab/paginated_response.rb +97 -0
- data/lib/gitlab/request.rb +65 -33
- data/lib/gitlab/shell.rb +84 -0
- data/lib/gitlab/shell_history.rb +59 -0
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/{project_branch.json → branch.json} +1 -1
- data/spec/fixtures/branch_delete.json +3 -0
- data/spec/fixtures/{project_branches.json → branches.json} +0 -0
- data/spec/fixtures/build.json +38 -0
- data/spec/fixtures/build_artifacts.json +0 -0
- data/spec/fixtures/build_cancel.json +24 -0
- data/spec/fixtures/build_erase.json +24 -0
- data/spec/fixtures/build_retry.json +24 -0
- data/spec/fixtures/builds.json +78 -0
- data/spec/fixtures/builds_commits.json +64 -0
- data/spec/fixtures/compare_merge_request_diff.json +31 -0
- data/spec/fixtures/error_project_not_found.json +1 -0
- data/spec/fixtures/get_repository_file.json +1 -0
- data/spec/fixtures/group_create_with_description.json +1 -0
- data/spec/fixtures/group_delete.json +1 -0
- data/spec/fixtures/group_member_edit.json +1 -0
- data/spec/fixtures/group_projects.json +44 -0
- data/spec/fixtures/group_search.json +2 -0
- data/spec/fixtures/label.json +1 -0
- data/spec/fixtures/labels.json +1 -0
- data/spec/fixtures/merge_request_changes.json +1 -0
- data/spec/fixtures/merge_request_closes_issues.json +1 -0
- data/spec/fixtures/{comment_merge_request.json → merge_request_comment.json} +0 -0
- data/spec/fixtures/merge_request_comments.json +1 -0
- data/spec/fixtures/merge_request_commits.json +1 -0
- data/spec/fixtures/milestone_issues.json +1 -0
- data/spec/fixtures/milestone_merge_requests.json +1 -0
- data/spec/fixtures/namespaces.json +1 -0
- data/spec/fixtures/pipeline.json +23 -0
- data/spec/fixtures/pipeline_cancel.json +23 -0
- data/spec/fixtures/pipeline_create.json +23 -0
- data/spec/fixtures/pipeline_retry.json +23 -0
- data/spec/fixtures/pipelines.json +48 -0
- data/spec/fixtures/project_commit.json +13 -0
- data/spec/fixtures/project_commit_comment.json +1 -0
- data/spec/fixtures/project_commit_comments.json +1 -0
- data/spec/fixtures/project_commit_create.json +22 -0
- data/spec/fixtures/project_commit_diff.json +10 -0
- data/spec/fixtures/project_commit_status.json +42 -0
- data/spec/fixtures/project_edit.json +21 -0
- data/spec/fixtures/project_events.json +1 -0
- data/spec/fixtures/project_fork.json +50 -0
- data/spec/fixtures/project_forked_for_user.json +50 -0
- data/spec/fixtures/project_runner_enable.json +7 -0
- data/spec/fixtures/project_runners.json +16 -0
- data/spec/fixtures/project_search.json +1 -0
- data/spec/fixtures/project_star.json +44 -0
- data/spec/fixtures/project_tag_annotated.json +1 -0
- data/spec/fixtures/project_tag_lightweight.json +1 -0
- data/spec/fixtures/project_unstar.json +44 -0
- data/spec/fixtures/project_update_commit_status.json +20 -0
- data/spec/fixtures/push_rule.json +1 -0
- data/spec/fixtures/raw_file.json +2 -0
- data/spec/fixtures/release_create.json +1 -0
- data/spec/fixtures/release_update.json +1 -0
- data/spec/fixtures/repository_file.json +1 -0
- data/spec/fixtures/runner.json +26 -0
- data/spec/fixtures/runner_delete.json +7 -0
- data/spec/fixtures/runner_edit.json +26 -0
- data/spec/fixtures/runners.json +16 -0
- data/spec/fixtures/runners_all.json +30 -0
- data/spec/fixtures/service.json +1 -0
- data/spec/fixtures/shell_history.json +2 -0
- data/spec/fixtures/snippet_content.json +3 -0
- data/spec/fixtures/system_hook.json +1 -0
- data/spec/fixtures/system_hooks.json +1 -0
- data/spec/fixtures/tag.json +1 -0
- data/spec/fixtures/tag_create.json +1 -0
- data/spec/fixtures/tag_create_with_description.json +1 -0
- data/spec/fixtures/tag_delete.json +1 -0
- data/spec/fixtures/tags.json +1 -0
- data/spec/fixtures/tree.json +1 -0
- data/spec/fixtures/trigger.json +7 -0
- data/spec/fixtures/triggers.json +16 -0
- data/spec/fixtures/user.json +1 -1
- data/spec/fixtures/user_block_unblock.json +1 -0
- data/spec/fixtures/user_email.json +1 -0
- data/spec/fixtures/user_emails.json +1 -0
- data/spec/fixtures/user_search.json +1 -0
- data/spec/fixtures/users.json +1 -1
- data/spec/fixtures/variable.json +4 -0
- data/spec/fixtures/variables.json +10 -0
- data/spec/gitlab/cli_helpers_spec.rb +57 -0
- data/spec/gitlab/cli_spec.rb +119 -0
- data/spec/gitlab/client/branches_spec.rb +99 -0
- data/spec/gitlab/client/build_triggers_spec.rb +67 -0
- data/spec/gitlab/client/build_variables_spec.rb +86 -0
- data/spec/gitlab/client/builds_spec.rb +148 -0
- data/spec/gitlab/client/client_spec.rb +11 -0
- data/spec/gitlab/client/commits_spec.rb +168 -0
- data/spec/gitlab/client/groups_spec.rb +116 -30
- data/spec/gitlab/client/issues_spec.rb +93 -29
- data/spec/gitlab/client/labels_spec.rb +68 -0
- data/spec/gitlab/client/merge_requests_spec.rb +171 -39
- data/spec/gitlab/client/milestones_spec.rb +45 -13
- data/spec/gitlab/client/namespaces_spec.rb +22 -0
- data/spec/gitlab/client/notes_spec.rb +82 -33
- data/spec/gitlab/client/pipelines_spec.rb +95 -0
- data/spec/gitlab/client/projects_spec.rb +371 -71
- data/spec/gitlab/client/repositories_spec.rb +51 -30
- data/spec/gitlab/client/repository_files_spec.rb +77 -0
- data/spec/gitlab/client/runners_spec.rb +185 -0
- data/spec/gitlab/client/services_spec.rb +55 -0
- data/spec/gitlab/client/snippets_spec.rb +35 -20
- data/spec/gitlab/client/system_hooks_spec.rb +69 -0
- data/spec/gitlab/client/tags_spec.rb +109 -0
- data/spec/gitlab/client/users_spec.rb +296 -34
- data/spec/gitlab/error_spec.rb +45 -0
- data/spec/gitlab/file_response_spec.rb +33 -0
- data/spec/gitlab/help_spec.rb +46 -0
- data/spec/gitlab/objectified_hash_spec.rb +48 -0
- data/spec/gitlab/page_links_spec.rb +16 -0
- data/spec/gitlab/paginated_response_spec.rb +60 -0
- data/spec/gitlab/request_spec.rb +73 -0
- data/spec/gitlab/shell_history_spec.rb +53 -0
- data/spec/gitlab/shell_spec.rb +80 -0
- data/spec/gitlab_spec.rb +48 -7
- data/spec/spec_helper.rb +24 -13
- metadata +287 -33
- data/spec/fixtures/create_merge_request.json +0 -1
- data/spec/fixtures/project_delete_key.json +0 -8
- data/spec/fixtures/update_merge_request.json +0 -1
|
@@ -10,30 +10,69 @@ describe Gitlab::Client do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it "should get the correct resource" do
|
|
13
|
-
a_get("/groups").
|
|
14
|
-
a_get("/groups/3").
|
|
13
|
+
expect(a_get("/groups")).to have_been_made
|
|
14
|
+
expect(a_get("/groups/3")).to have_been_made
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
it "should return
|
|
18
|
-
@groups.
|
|
19
|
-
@groups.first.path.
|
|
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
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
describe ".create_group" do
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
27
58
|
end
|
|
59
|
+
end
|
|
28
60
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
61
|
+
describe ".delete_group" do
|
|
62
|
+
context "without description" do
|
|
63
|
+
before do
|
|
64
|
+
stub_delete("/groups/42", "group_delete")
|
|
65
|
+
@group = Gitlab.delete_group(42)
|
|
66
|
+
end
|
|
33
67
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
68
|
+
it "should get the correct resource" do
|
|
69
|
+
expect(a_delete("/groups/42")).to have_been_made
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "should return information about a deleted group" do
|
|
73
|
+
expect(@group.name).to eq("Gitlab-Group")
|
|
74
|
+
expect(@group.path).to eq("gitlab-group")
|
|
75
|
+
end
|
|
37
76
|
end
|
|
38
77
|
end
|
|
39
78
|
|
|
@@ -45,17 +84,17 @@ describe Gitlab::Client do
|
|
|
45
84
|
@group = Gitlab.create_group('GitLab-Group', 'gitlab-path')
|
|
46
85
|
|
|
47
86
|
stub_post("/groups/#{@group.id}/projects/#{@project.id}", "group_create")
|
|
48
|
-
@group_transfer = Gitlab.transfer_project_to_group(@group.id
|
|
87
|
+
@group_transfer = Gitlab.transfer_project_to_group(@group.id, @project.id)
|
|
49
88
|
end
|
|
50
89
|
|
|
51
90
|
it "should post to the correct resource" do
|
|
52
|
-
a_post("/groups/#{@group.id}/projects/#{@project.id}").with(:
|
|
91
|
+
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
|
|
53
92
|
end
|
|
54
93
|
|
|
55
94
|
it "should return information about the group" do
|
|
56
|
-
@group_transfer.name.
|
|
57
|
-
@group_transfer.path.
|
|
58
|
-
@group_transfer.id.
|
|
95
|
+
expect(@group_transfer.name).to eq(@group.name)
|
|
96
|
+
expect(@group_transfer.path).to eq(@group.path)
|
|
97
|
+
expect(@group_transfer.id).to eq(@group.id)
|
|
59
98
|
end
|
|
60
99
|
end
|
|
61
100
|
|
|
@@ -66,13 +105,13 @@ describe Gitlab::Client do
|
|
|
66
105
|
end
|
|
67
106
|
|
|
68
107
|
it "should get the correct resource" do
|
|
69
|
-
a_get("/groups/3/members").
|
|
108
|
+
expect(a_get("/groups/3/members")).to have_been_made
|
|
70
109
|
end
|
|
71
110
|
|
|
72
111
|
it "should return information about a group members" do
|
|
73
|
-
@members.
|
|
74
|
-
@members.size.
|
|
75
|
-
@members[1].name.
|
|
112
|
+
expect(@members).to be_a Gitlab::PaginatedResponse
|
|
113
|
+
expect(@members.size).to eq(2)
|
|
114
|
+
expect(@members[1].name).to eq("John Smith")
|
|
76
115
|
end
|
|
77
116
|
end
|
|
78
117
|
|
|
@@ -83,12 +122,28 @@ describe Gitlab::Client do
|
|
|
83
122
|
end
|
|
84
123
|
|
|
85
124
|
it "should get the correct resource" do
|
|
86
|
-
a_post("/groups/3/members").
|
|
87
|
-
with(:
|
|
125
|
+
expect(a_post("/groups/3/members").
|
|
126
|
+
with(body: { user_id: '1', access_level: '40' })).to have_been_made
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
it "should return information about the added member" do
|
|
130
|
+
expect(@member.name).to eq("John Smith")
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
describe ".edit_group_member" do
|
|
135
|
+
before do
|
|
136
|
+
stub_put("/groups/3/members/1", "group_member_edit")
|
|
137
|
+
@member = Gitlab.edit_group_member(3, 1, 50)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
it "should get the correct resource" do
|
|
141
|
+
expect(a_put("/groups/3/members/1")
|
|
142
|
+
.with(body: { access_level: '50'})).to have_been_made
|
|
88
143
|
end
|
|
89
144
|
|
|
90
|
-
it "should return information about
|
|
91
|
-
@member.
|
|
145
|
+
it "should return information about the edited member" do
|
|
146
|
+
expect(@member.access_level).to eq(50)
|
|
92
147
|
end
|
|
93
148
|
end
|
|
94
149
|
|
|
@@ -99,13 +154,44 @@ describe Gitlab::Client do
|
|
|
99
154
|
end
|
|
100
155
|
|
|
101
156
|
it "should get the correct resource" do
|
|
102
|
-
a_delete("/groups/3/members/1").
|
|
157
|
+
expect(a_delete("/groups/3/members/1")).to have_been_made
|
|
103
158
|
end
|
|
104
159
|
|
|
105
160
|
it "should return information about the group the member was removed from" do
|
|
106
|
-
@group.group_id.
|
|
161
|
+
expect(@group.group_id).to eq(3)
|
|
107
162
|
end
|
|
108
163
|
end
|
|
109
164
|
|
|
165
|
+
describe ".group_projects" do
|
|
166
|
+
before do
|
|
167
|
+
stub_get("/groups/4/projects", "group_projects")
|
|
168
|
+
@projects = Gitlab.group_projects(4)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it "should get the list of projects" do
|
|
172
|
+
expect(a_get("/groups/4/projects")).to have_been_made
|
|
173
|
+
end
|
|
110
174
|
|
|
175
|
+
it "should return a list of of projects under a group" do
|
|
176
|
+
expect(@projects).to be_a Gitlab::PaginatedResponse
|
|
177
|
+
expect(@projects.size).to eq(1)
|
|
178
|
+
expect(@projects[0].name).to eq("Diaspora Client")
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
describe ".group_search" do
|
|
183
|
+
before do
|
|
184
|
+
stub_get("/groups?search=Group", "group_search")
|
|
185
|
+
@groups = Gitlab.group_search('Group')
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
it "should get the correct resource" do
|
|
189
|
+
expect(a_get("/groups?search=Group")).to have_been_made
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
it "should return an array of groups found" do
|
|
193
|
+
expect(@groups.first.id).to eq(5)
|
|
194
|
+
expect(@groups.last.id).to eq(8)
|
|
195
|
+
end
|
|
196
|
+
end
|
|
111
197
|
end
|
|
@@ -9,12 +9,28 @@ describe Gitlab::Client do
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
it "should get the correct resource" do
|
|
12
|
-
a_get("/projects/3/issues").
|
|
12
|
+
expect(a_get("/projects/3/issues")).to have_been_made
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
it "should return
|
|
16
|
-
@issues.
|
|
17
|
-
@issues.first.project_id.
|
|
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)
|
|
18
34
|
end
|
|
19
35
|
end
|
|
20
36
|
|
|
@@ -25,13 +41,13 @@ describe Gitlab::Client do
|
|
|
25
41
|
end
|
|
26
42
|
|
|
27
43
|
it "should get the correct resource" do
|
|
28
|
-
a_get("/issues").
|
|
44
|
+
expect(a_get("/issues")).to have_been_made
|
|
29
45
|
end
|
|
30
46
|
|
|
31
|
-
it "should return
|
|
32
|
-
@issues.
|
|
33
|
-
@issues.first.closed.
|
|
34
|
-
@issues.first.author.name.
|
|
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")
|
|
35
51
|
end
|
|
36
52
|
end
|
|
37
53
|
end
|
|
@@ -43,12 +59,12 @@ describe Gitlab::Client do
|
|
|
43
59
|
end
|
|
44
60
|
|
|
45
61
|
it "should get the correct resource" do
|
|
46
|
-
a_get("/projects/3/issues/33").
|
|
62
|
+
expect(a_get("/projects/3/issues/33")).to have_been_made
|
|
47
63
|
end
|
|
48
64
|
|
|
49
65
|
it "should return information about an issue" do
|
|
50
|
-
@issue.project_id.
|
|
51
|
-
@issue.assignee.name.
|
|
66
|
+
expect(@issue.project_id).to eq(3)
|
|
67
|
+
expect(@issue.assignee.name).to eq("Jack Smith")
|
|
52
68
|
end
|
|
53
69
|
end
|
|
54
70
|
|
|
@@ -59,30 +75,30 @@ describe Gitlab::Client do
|
|
|
59
75
|
end
|
|
60
76
|
|
|
61
77
|
it "should get the correct resource" do
|
|
62
|
-
a_post("/projects/3/issues").
|
|
63
|
-
with(:
|
|
78
|
+
expect(a_post("/projects/3/issues").
|
|
79
|
+
with(body: { title: 'title' })).to have_been_made
|
|
64
80
|
end
|
|
65
81
|
|
|
66
82
|
it "should return information about a created issue" do
|
|
67
|
-
@issue.project_id.
|
|
68
|
-
@issue.assignee.name.
|
|
83
|
+
expect(@issue.project_id).to eq(3)
|
|
84
|
+
expect(@issue.assignee.name).to eq("Jack Smith")
|
|
69
85
|
end
|
|
70
86
|
end
|
|
71
87
|
|
|
72
88
|
describe ".edit_issue" do
|
|
73
89
|
before do
|
|
74
90
|
stub_put("/projects/3/issues/33", "issue")
|
|
75
|
-
@issue = Gitlab.edit_issue(3, 33, :
|
|
91
|
+
@issue = Gitlab.edit_issue(3, 33, title: 'title')
|
|
76
92
|
end
|
|
77
93
|
|
|
78
94
|
it "should get the correct resource" do
|
|
79
|
-
a_put("/projects/3/issues/33").
|
|
80
|
-
with(:
|
|
95
|
+
expect(a_put("/projects/3/issues/33").
|
|
96
|
+
with(body: { title: 'title' })).to have_been_made
|
|
81
97
|
end
|
|
82
98
|
|
|
83
99
|
it "should return information about an edited issue" do
|
|
84
|
-
@issue.project_id.
|
|
85
|
-
@issue.assignee.name.
|
|
100
|
+
expect(@issue.project_id).to eq(3)
|
|
101
|
+
expect(@issue.assignee.name).to eq("Jack Smith")
|
|
86
102
|
end
|
|
87
103
|
end
|
|
88
104
|
|
|
@@ -93,13 +109,13 @@ describe Gitlab::Client do
|
|
|
93
109
|
end
|
|
94
110
|
|
|
95
111
|
it "should get the correct resource" do
|
|
96
|
-
a_put("/projects/3/issues/33").
|
|
97
|
-
with(:
|
|
112
|
+
expect(a_put("/projects/3/issues/33").
|
|
113
|
+
with(body: { state_event: 'close' })).to have_been_made
|
|
98
114
|
end
|
|
99
115
|
|
|
100
116
|
it "should return information about an closed issue" do
|
|
101
|
-
@issue.project_id.
|
|
102
|
-
@issue.assignee.name.
|
|
117
|
+
expect(@issue.project_id).to eq(3)
|
|
118
|
+
expect(@issue.assignee.name).to eq("Jack Smith")
|
|
103
119
|
end
|
|
104
120
|
end
|
|
105
121
|
|
|
@@ -110,13 +126,61 @@ describe Gitlab::Client do
|
|
|
110
126
|
end
|
|
111
127
|
|
|
112
128
|
it "should get the correct resource" do
|
|
113
|
-
a_put("/projects/3/issues/33").
|
|
114
|
-
with(:
|
|
129
|
+
expect(a_put("/projects/3/issues/33").
|
|
130
|
+
with(body: { state_event: 'reopen' })).to have_been_made
|
|
115
131
|
end
|
|
116
132
|
|
|
117
133
|
it "should return information about an reopened issue" do
|
|
118
|
-
@issue.project_id.
|
|
119
|
-
@issue.assignee.name.
|
|
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)
|
|
120
184
|
end
|
|
121
185
|
end
|
|
122
186
|
end
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
end
|