gitlab 3.7.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 +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +24 -0
- data/README.md +7 -6
- data/gitlab.gemspec +4 -6
- data/lib/gitlab/client.rb +24 -0
- data/lib/gitlab/client/branches.rb +13 -13
- data/lib/gitlab/client/build_triggers.rb +9 -9
- data/lib/gitlab/client/build_variables.rb +11 -11
- data/lib/gitlab/client/builds.rb +16 -16
- data/lib/gitlab/client/commits.rb +39 -14
- data/lib/gitlab/client/groups.rb +1 -1
- data/lib/gitlab/client/issues.rb +40 -16
- data/lib/gitlab/client/labels.rb +9 -9
- data/lib/gitlab/client/merge_requests.rb +61 -24
- data/lib/gitlab/client/milestones.rb +25 -11
- data/lib/gitlab/client/namespaces.rb +2 -1
- data/lib/gitlab/client/notes.rb +16 -16
- data/lib/gitlab/client/pipelines.rb +68 -0
- data/lib/gitlab/client/projects.rb +111 -49
- data/lib/gitlab/client/repositories.rb +27 -23
- data/lib/gitlab/client/repository_files.rb +29 -10
- data/lib/gitlab/client/runners.rb +15 -15
- data/lib/gitlab/client/services.rb +8 -6
- data/lib/gitlab/client/snippets.rb +13 -13
- data/lib/gitlab/client/system_hooks.rb +1 -1
- data/lib/gitlab/client/tags.rb +13 -13
- data/lib/gitlab/client/users.rb +12 -5
- data/lib/gitlab/file_response.rb +1 -0
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/merge_request_closes_issues.json +1 -0
- data/spec/fixtures/milestone_merge_requests.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_create.json +22 -0
- data/spec/fixtures/project_star.json +44 -0
- data/spec/fixtures/project_unstar.json +44 -0
- data/spec/fixtures/{git_hook.json → push_rule.json} +0 -0
- data/spec/gitlab/cli_spec.rb +9 -0
- data/spec/gitlab/client/client_spec.rb +11 -0
- data/spec/gitlab/client/commits_spec.rb +31 -0
- data/spec/gitlab/client/issues_spec.rb +48 -0
- data/spec/gitlab/client/merge_requests_spec.rb +57 -10
- data/spec/gitlab/client/milestones_spec.rb +16 -0
- data/spec/gitlab/client/pipelines_spec.rb +95 -0
- data/spec/gitlab/client/projects_spec.rb +116 -38
- data/spec/gitlab/client/repositories_spec.rb +0 -15
- data/spec/gitlab/client/repository_files_spec.rb +17 -2
- data/spec/gitlab/client/users_spec.rb +31 -13
- data/spec/gitlab/file_response_spec.rb +6 -1
- metadata +53 -43
data/lib/gitlab/client/users.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Gitlab::Client
|
2
2
|
# Defines methods related to users.
|
3
|
-
# @see https://
|
4
|
-
# @see https://
|
3
|
+
# @see https://docs.gitlab.com/ce/api/users.html
|
4
|
+
# @see https://docs.gitlab.com/ce/api/session.html
|
5
5
|
module Users
|
6
6
|
# Gets a list of users.
|
7
7
|
#
|
@@ -96,7 +96,7 @@ class Gitlab::Client
|
|
96
96
|
# @param [Integer] user_id The Id of user
|
97
97
|
# @return [Boolean] success or not
|
98
98
|
def block_user(user_id)
|
99
|
-
|
99
|
+
post("/users/#{user_id}/block")
|
100
100
|
end
|
101
101
|
|
102
102
|
# Unblocks the specified user. Available only for admin.
|
@@ -107,7 +107,7 @@ class Gitlab::Client
|
|
107
107
|
# @param [Integer] user_id The Id of user
|
108
108
|
# @return [Boolean] success or not
|
109
109
|
def unblock_user(user_id)
|
110
|
-
|
110
|
+
post("/users/#{user_id}/unblock")
|
111
111
|
end
|
112
112
|
|
113
113
|
# Creates a new user session.
|
@@ -127,13 +127,20 @@ class Gitlab::Client
|
|
127
127
|
#
|
128
128
|
# @example
|
129
129
|
# Gitlab.ssh_keys
|
130
|
+
# Gitlab.ssh_keys({ user_id: 2 })
|
130
131
|
#
|
131
132
|
# @param [Hash] options A customizable set of options.
|
132
133
|
# @option options [Integer] :page The page number.
|
133
134
|
# @option options [Integer] :per_page The number of results per page.
|
135
|
+
# @option options [Integer] :user_id The ID of the user to retrieve the keys for.
|
134
136
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
135
137
|
def ssh_keys(options={})
|
136
|
-
|
138
|
+
user_id = options.delete :user_id
|
139
|
+
if user_id.to_i.zero?
|
140
|
+
get("/user/keys", query: options)
|
141
|
+
else
|
142
|
+
get("/users/#{user_id}/keys", query: options)
|
143
|
+
end
|
137
144
|
end
|
138
145
|
|
139
146
|
# Gets information about SSH key.
|
data/lib/gitlab/file_response.rb
CHANGED
@@ -40,6 +40,7 @@ module Gitlab
|
|
40
40
|
# Parse filename from the 'Content Disposition' header.
|
41
41
|
def parse_headers!(headers)
|
42
42
|
@filename = headers[HEADER_CONTENT_DISPOSITION].split("filename=")[1]
|
43
|
+
@filename = @filename[1...-1] if @filename[0] == '"' # Unquote filenames
|
43
44
|
end
|
44
45
|
end
|
45
46
|
end
|
data/lib/gitlab/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
[{"id":1,"iid":1,"project_id":5,"title":"Merge request 1 issue 1","description":"","state":"opened","created_at":"2017-04-06T08:03:36.163Z","updated_at":"2017-04-06T08:03:57.087Z","labels":[],"milestone":null,"assignee":null,"author":{"name":"John","username":"jdoe","id":1,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoe"},"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/issues/1"},{"id":2,"iid":2,"project_id":5,"title":"Merge request 1 issue 2","description":"","state":"opened","created_at":"2017-04-06T08:03:44.023Z","updated_at":"2017-04-06T08:03:44.023Z","labels":[],"milestone":null,"assignee":null,"author":{"name":"John","username":"jdoe","id":426047,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoe"},"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/issues/2"}]
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"id":1,"iid":1,"project_id":1,"title":"lorem ipsum","description":"","state":"opened","created_at":"2017-03-24T12:23:53.918Z","updated_at":"2017-03-24T12:23:53.918Z","target_branch":"master","source_branch":"def","upvotes":0,"downvotes":0,"author":{"name":"John Doe","username":"jdoe","id":1,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoen"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"aec123d1775790b2347fdd684b5ba613fdeb994b","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":false,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/2"},{"id":2,"iid":2,"project_id":1,"title":"ipsum lorem","description":"","state":"opened","created_at":"2017-03-24T12:23:24.662Z","updated_at":"2017-03-24T12:23:33.522Z","target_branch":"master","source_branch":"test1","upvotes":0,"downvotes":0,"author":{"name":"Joren","username":"jdoe","id":1,"state":"active","":"","web_url":"https://gitlab.com/jdoe"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"3ee44c9b40deddae596f838b97523c6f010fd80d","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":true,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/1"}]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"id": 46,
|
3
|
+
"status": "success",
|
4
|
+
"ref": "master",
|
5
|
+
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
|
6
|
+
"before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
|
7
|
+
"tag": false,
|
8
|
+
"yaml_errors": null,
|
9
|
+
"user": {
|
10
|
+
"name": "Administrator",
|
11
|
+
"username": "root",
|
12
|
+
"id": 1,
|
13
|
+
"state": "active",
|
14
|
+
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
|
15
|
+
"web_url": "http://localhost:3000/root"
|
16
|
+
},
|
17
|
+
"created_at": "2016-08-11T11:28:34.085Z",
|
18
|
+
"updated_at": "2016-08-11T11:32:35.169Z",
|
19
|
+
"started_at": null,
|
20
|
+
"finished_at": "2016-08-11T11:32:35.145Z",
|
21
|
+
"committed_at": null,
|
22
|
+
"duration": null
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"id": 46,
|
3
|
+
"status": "canceled",
|
4
|
+
"ref": "master",
|
5
|
+
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
|
6
|
+
"before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
|
7
|
+
"tag": false,
|
8
|
+
"yaml_errors": null,
|
9
|
+
"user": {
|
10
|
+
"name": "Administrator",
|
11
|
+
"username": "root",
|
12
|
+
"id": 1,
|
13
|
+
"state": "active",
|
14
|
+
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
|
15
|
+
"web_url": "http://localhost:3000/root"
|
16
|
+
},
|
17
|
+
"created_at": "2016-08-11T11:28:34.085Z",
|
18
|
+
"updated_at": "2016-08-11T11:32:35.169Z",
|
19
|
+
"started_at": null,
|
20
|
+
"finished_at": "2016-08-11T11:32:35.145Z",
|
21
|
+
"committed_at": null,
|
22
|
+
"duration": null
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"id": 61,
|
3
|
+
"sha": "384c444e840a515b23f21915ee5766b87068a70d",
|
4
|
+
"ref": "master",
|
5
|
+
"status": "pending",
|
6
|
+
"before_sha": "0000000000000000000000000000000000000000",
|
7
|
+
"tag": false,
|
8
|
+
"yaml_errors": null,
|
9
|
+
"user": {
|
10
|
+
"name": "Administrator",
|
11
|
+
"username": "root",
|
12
|
+
"id": 1,
|
13
|
+
"state": "active",
|
14
|
+
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
|
15
|
+
"web_url": "http://localhost:3000/root"
|
16
|
+
},
|
17
|
+
"created_at": "2016-11-04T09:36:13.747Z",
|
18
|
+
"updated_at": "2016-11-04T09:36:13.977Z",
|
19
|
+
"started_at": null,
|
20
|
+
"finished_at": null,
|
21
|
+
"committed_at": null,
|
22
|
+
"duration": null
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"id": 46,
|
3
|
+
"status": "pending",
|
4
|
+
"ref": "master",
|
5
|
+
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
|
6
|
+
"before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
|
7
|
+
"tag": false,
|
8
|
+
"yaml_errors": null,
|
9
|
+
"user": {
|
10
|
+
"name": "Administrator",
|
11
|
+
"username": "root",
|
12
|
+
"id": 1,
|
13
|
+
"state": "active",
|
14
|
+
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
|
15
|
+
"web_url": "http://localhost:3000/root"
|
16
|
+
},
|
17
|
+
"created_at": "2016-08-11T11:28:34.085Z",
|
18
|
+
"updated_at": "2016-08-11T11:32:35.169Z",
|
19
|
+
"started_at": null,
|
20
|
+
"finished_at": "2016-08-11T11:32:35.145Z",
|
21
|
+
"committed_at": null,
|
22
|
+
"duration": null
|
23
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 47,
|
4
|
+
"status": "pending",
|
5
|
+
"ref": "new-pipeline",
|
6
|
+
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
|
7
|
+
"before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
|
8
|
+
"tag": false,
|
9
|
+
"yaml_errors": null,
|
10
|
+
"user": {
|
11
|
+
"name": "Administrator",
|
12
|
+
"username": "root",
|
13
|
+
"id": 1,
|
14
|
+
"state": "active",
|
15
|
+
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
|
16
|
+
"web_url": "http://localhost:3000/root"
|
17
|
+
},
|
18
|
+
"created_at": "2016-08-16T10:23:19.007Z",
|
19
|
+
"updated_at": "2016-08-16T10:23:19.216Z",
|
20
|
+
"started_at": null,
|
21
|
+
"finished_at": null,
|
22
|
+
"committed_at": null,
|
23
|
+
"duration": null
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"id": 48,
|
27
|
+
"status": "pending",
|
28
|
+
"ref": "new-pipeline",
|
29
|
+
"sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a",
|
30
|
+
"before_sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a",
|
31
|
+
"tag": false,
|
32
|
+
"yaml_errors": null,
|
33
|
+
"user": {
|
34
|
+
"name": "Administrator",
|
35
|
+
"username": "root",
|
36
|
+
"id": 1,
|
37
|
+
"state": "active",
|
38
|
+
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
|
39
|
+
"web_url": "http://localhost:3000/root"
|
40
|
+
},
|
41
|
+
"created_at": "2016-08-16T10:23:21.184Z",
|
42
|
+
"updated_at": "2016-08-16T10:23:21.314Z",
|
43
|
+
"started_at": null,
|
44
|
+
"finished_at": null,
|
45
|
+
"committed_at": null,
|
46
|
+
"duration": null
|
47
|
+
}
|
48
|
+
]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"id": "ed899a2f4b50b4370feeea94676502b42383c746",
|
3
|
+
"short_id": "ed899a2f4b5",
|
4
|
+
"title": "some commit message",
|
5
|
+
"author_name": "Dmitriy Zaporozhets",
|
6
|
+
"author_email": "dzaporozhets@sphereconsultinginc.com",
|
7
|
+
"committer_name": "Dmitriy Zaporozhets",
|
8
|
+
"committer_email": "dzaporozhets@sphereconsultinginc.com",
|
9
|
+
"created_at": "2016-09-20T09:26:24.000-07:00",
|
10
|
+
"message": "some commit message",
|
11
|
+
"parent_ids": [
|
12
|
+
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
|
13
|
+
],
|
14
|
+
"committed_date": "2016-09-20T09:26:24.000-07:00",
|
15
|
+
"authored_date": "2016-09-20T09:26:24.000-07:00",
|
16
|
+
"stats": {
|
17
|
+
"additions": 2,
|
18
|
+
"deletions": 2,
|
19
|
+
"total": 4
|
20
|
+
},
|
21
|
+
"status": null
|
22
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"id": 3,
|
3
|
+
"description": null,
|
4
|
+
"default_branch": "master",
|
5
|
+
"public": false,
|
6
|
+
"visibility_level": 10,
|
7
|
+
"ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git",
|
8
|
+
"http_url_to_repo":"http://git.gitlab.com/root/gitlab.git",
|
9
|
+
"web_url":"http://git.gitlab.com/root/gitlab",
|
10
|
+
"tag_list": [
|
11
|
+
|
12
|
+
],
|
13
|
+
"name": "GitLab Community Edition",
|
14
|
+
"name_with_namespace": "GitLab / GitLab Community Edition",
|
15
|
+
"path": "gitlab-ce",
|
16
|
+
"path_with_namespace": "gitlab/gitlab-ce",
|
17
|
+
"issues_enabled": true,
|
18
|
+
"open_issues_count": 1,
|
19
|
+
"merge_requests_enabled": true,
|
20
|
+
"builds_enabled": true,
|
21
|
+
"wiki_enabled": true,
|
22
|
+
"snippets_enabled": false,
|
23
|
+
"container_registry_enabled": false,
|
24
|
+
"created_at": "2013-09-30T13:46:02Z",
|
25
|
+
"last_activity_at": "2013-09-30T13:46:02Z",
|
26
|
+
"creator_id": 3,
|
27
|
+
"namespace": {
|
28
|
+
"created_at": "2013-09-30T13:46:02Z",
|
29
|
+
"description": "",
|
30
|
+
"id": 3,
|
31
|
+
"name": "GitLab",
|
32
|
+
"owner_id": 1,
|
33
|
+
"path": "gitlab",
|
34
|
+
"updated_at": "2013-09-30T13:46:02Z"
|
35
|
+
},
|
36
|
+
"archived": true,
|
37
|
+
"avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
|
38
|
+
"shared_runners_enabled": true,
|
39
|
+
"forks_count": 0,
|
40
|
+
"star_count": 1,
|
41
|
+
"public_builds": true,
|
42
|
+
"shared_with_groups": [],
|
43
|
+
"only_allow_merge_if_build_succeeds": false
|
44
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"id": 3,
|
3
|
+
"description": null,
|
4
|
+
"default_branch": "master",
|
5
|
+
"public": false,
|
6
|
+
"visibility_level": 10,
|
7
|
+
"ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git",
|
8
|
+
"http_url_to_repo":"http://git.gitlab.com/root/gitlab.git",
|
9
|
+
"web_url":"http://git.gitlab.com/root/gitlab",
|
10
|
+
"tag_list": [
|
11
|
+
|
12
|
+
],
|
13
|
+
"name": "GitLab Community Edition",
|
14
|
+
"name_with_namespace": "GitLab / GitLab Community Edition",
|
15
|
+
"path": "gitlab-ce",
|
16
|
+
"path_with_namespace": "gitlab/gitlab-ce",
|
17
|
+
"issues_enabled": true,
|
18
|
+
"open_issues_count": 1,
|
19
|
+
"merge_requests_enabled": true,
|
20
|
+
"builds_enabled": true,
|
21
|
+
"wiki_enabled": true,
|
22
|
+
"snippets_enabled": false,
|
23
|
+
"container_registry_enabled": false,
|
24
|
+
"created_at": "2013-09-30T13:46:02Z",
|
25
|
+
"last_activity_at": "2013-09-30T13:46:02Z",
|
26
|
+
"creator_id": 3,
|
27
|
+
"namespace": {
|
28
|
+
"created_at": "2013-09-30T13:46:02Z",
|
29
|
+
"description": "",
|
30
|
+
"id": 3,
|
31
|
+
"name": "GitLab",
|
32
|
+
"owner_id": 1,
|
33
|
+
"path": "gitlab",
|
34
|
+
"updated_at": "2013-09-30T13:46:02Z"
|
35
|
+
},
|
36
|
+
"archived": true,
|
37
|
+
"avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
|
38
|
+
"shared_runners_enabled": true,
|
39
|
+
"forks_count": 0,
|
40
|
+
"star_count": 0,
|
41
|
+
"public_builds": true,
|
42
|
+
"shared_with_groups": [],
|
43
|
+
"only_allow_merge_if_build_succeeds": false
|
44
|
+
}
|
File without changes
|
data/spec/gitlab/cli_spec.rb
CHANGED
@@ -106,5 +106,14 @@ describe Gitlab::CLI do
|
|
106
106
|
expect(@output).to_not include('created_at')
|
107
107
|
end
|
108
108
|
end
|
109
|
+
|
110
|
+
context "fetch project with namespace/repo" do
|
111
|
+
it "should encode delimiter" do
|
112
|
+
stub_get("/projects/gitlab-org%2Fgitlab-ce", "project")
|
113
|
+
args = ['project', 'gitlab-org/gitlab-ce']
|
114
|
+
@output = capture_output { Gitlab::CLI.start(args) }
|
115
|
+
expect(@output).to include('id')
|
116
|
+
end
|
117
|
+
end
|
109
118
|
end
|
110
119
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gitlab::Client do
|
4
|
+
describe '#inspect' do
|
5
|
+
it 'masks tokens on inspect' do
|
6
|
+
client = described_class.new(private_token: 'ui3gIYf4MMzTx-Oh5cEBx')
|
7
|
+
inspected = client.inspect
|
8
|
+
expect(inspected).to include('****************cEBx')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -134,4 +134,35 @@ describe Gitlab::Client do
|
|
134
134
|
expect(@status.ref).to eq('decreased-spec')
|
135
135
|
end
|
136
136
|
end
|
137
|
+
|
138
|
+
describe ".create_commit" do
|
139
|
+
let(:actions) do
|
140
|
+
[
|
141
|
+
{
|
142
|
+
action: "create",
|
143
|
+
file_path: "foo/bar",
|
144
|
+
content: "some content"
|
145
|
+
}
|
146
|
+
]
|
147
|
+
end
|
148
|
+
|
149
|
+
let(:query) do
|
150
|
+
{
|
151
|
+
branch_name: 'dev',
|
152
|
+
commit_message: 'refactors everything',
|
153
|
+
actions: actions,
|
154
|
+
author_email: 'joe@sample.org',
|
155
|
+
author_name: 'Joe Sample'
|
156
|
+
}
|
157
|
+
end
|
158
|
+
|
159
|
+
before do
|
160
|
+
stub_post("/projects/6/repository/commits", 'project_commit_create').with(query: query)
|
161
|
+
@commit = Gitlab.create_commit(6, 'dev', 'refactors everything', actions, {author_email: 'joe@sample.org', author_name: 'Joe Sample'})
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should return id of a created commit" do
|
165
|
+
expect(@commit.id).to eq('ed899a2f4b50b4370feeea94676502b42383c746')
|
166
|
+
end
|
167
|
+
end
|
137
168
|
end
|
@@ -18,6 +18,22 @@ describe Gitlab::Client do
|
|
18
18
|
end
|
19
19
|
end
|
20
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
|
+
|
21
37
|
context "without project ID passed" do
|
22
38
|
before do
|
23
39
|
stub_get("/issues", "issues")
|
@@ -120,6 +136,38 @@ describe Gitlab::Client do
|
|
120
136
|
end
|
121
137
|
end
|
122
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
|
+
|
123
171
|
describe ".delete_issue" do
|
124
172
|
before do
|
125
173
|
stub_delete("/projects/3/issues/33", "issue")
|