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,135 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe '.jobs' do
|
5
|
-
before do
|
6
|
-
stub_get('/projects/1/jobs', 'jobs')
|
7
|
-
@projects = Gitlab.jobs(1)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'gets the correct resource' do
|
11
|
-
expect(a_get('/projects/1/jobs')).to have_been_made
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '.jobs - with scopes' do
|
16
|
-
before do
|
17
|
-
stub_get('/projects/1/jobs?scope[]=created&scope[]=running', 'jobs')
|
18
|
-
@projects = Gitlab.jobs(1, scope: %w[created running])
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'gets the correct resource' do
|
22
|
-
expect(a_get('/projects/1/jobs?scope[]=created&scope[]=running')).to have_been_made
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '.pipeline_jobs' do
|
27
|
-
before do
|
28
|
-
stub_get('/projects/1/pipelines/1/jobs', 'pipeline_jobs')
|
29
|
-
@projects = Gitlab.pipeline_jobs(1, 1)
|
30
|
-
end
|
31
|
-
it 'gets the correct resource' do
|
32
|
-
expect(a_get('/projects/1/pipelines/1/jobs')).to have_been_made
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe '.pipeline_jobs - with scope' do
|
37
|
-
before do
|
38
|
-
stub_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created', 'pipeline_jobs')
|
39
|
-
@projects = Gitlab.pipeline_jobs(1, 1, scope: %w[running created])
|
40
|
-
end
|
41
|
-
it 'gets the correct resource' do
|
42
|
-
expect(a_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created')).to have_been_made
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '.job' do
|
47
|
-
before do
|
48
|
-
stub_get('/projects/1/jobs/1', 'job')
|
49
|
-
@projects = Gitlab.job(1, 1)
|
50
|
-
end
|
51
|
-
it 'gets the correct resource' do
|
52
|
-
expect(a_get('/projects/1/jobs/1')).to have_been_made
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '.job_artifacts' do
|
57
|
-
before do
|
58
|
-
stub_get('/projects/1/jobs/1/artifacts', 'job')
|
59
|
-
@projects = Gitlab.job_artifacts(1, 1)
|
60
|
-
end
|
61
|
-
it 'gets the correct resource' do
|
62
|
-
expect(a_get('/projects/1/jobs/1/artifacts')).to have_been_made
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '.job_artifacts_download' do
|
67
|
-
before do
|
68
|
-
stub_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build', 'job')
|
69
|
-
@projects = Gitlab.job_artifacts_download(1, 'master', 'Release Build')
|
70
|
-
end
|
71
|
-
it 'gets the correct resource' do
|
72
|
-
expect(a_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build')).to have_been_made
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe '.job_trace' do
|
77
|
-
before do
|
78
|
-
stub_get('/projects/1/jobs/1/trace', 'job_trace')
|
79
|
-
@projects = Gitlab.job_trace(1, 1)
|
80
|
-
end
|
81
|
-
it 'gets the correct resource' do
|
82
|
-
expect(a_get('/projects/1/jobs/1/trace')).to have_been_made
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe '.job_cancel' do
|
87
|
-
before do
|
88
|
-
stub_post('/projects/1/jobs/1/cancel', 'job')
|
89
|
-
@projects = Gitlab.job_cancel(1, 1)
|
90
|
-
end
|
91
|
-
it 'gets the correct resource' do
|
92
|
-
expect(a_post('/projects/1/jobs/1/cancel')).to have_been_made
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe '.job_retry' do
|
97
|
-
before do
|
98
|
-
stub_post('/projects/1/jobs/1/retry', 'job')
|
99
|
-
@projects = Gitlab.job_retry(1, 1)
|
100
|
-
end
|
101
|
-
it 'gets the correct resource' do
|
102
|
-
expect(a_post('/projects/1/jobs/1/retry')).to have_been_made
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe '.job_erase' do
|
107
|
-
before do
|
108
|
-
stub_post('/projects/1/jobs/1/erase', 'job')
|
109
|
-
@projects = Gitlab.job_erase(1, 1)
|
110
|
-
end
|
111
|
-
it 'gets the correct resource' do
|
112
|
-
expect(a_post('/projects/1/jobs/1/erase')).to have_been_made
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
describe '.job_play' do
|
117
|
-
before do
|
118
|
-
stub_post('/projects/1/jobs/1/play', 'job')
|
119
|
-
@projects = Gitlab.job_play(1, 1)
|
120
|
-
end
|
121
|
-
it 'gets the correct resource' do
|
122
|
-
expect(a_post('/projects/1/jobs/1/play')).to have_been_made
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
describe '.job_artifacts_keep' do
|
127
|
-
before do
|
128
|
-
stub_post('/projects/1/jobs/1/artifacts/keep', 'job')
|
129
|
-
@projects = Gitlab.job_artifacts_keep(1, 1)
|
130
|
-
end
|
131
|
-
it 'gets the correct resource' do
|
132
|
-
expect(a_post('/projects/1/jobs/1/artifacts/keep')).to have_been_made
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".key" do
|
5
|
-
before do
|
6
|
-
stub_get("/keys/1", "key")
|
7
|
-
@key = Gitlab.key(1)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/keys/1")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns information about a key" do
|
15
|
-
expect(@key.id).to eq(1)
|
16
|
-
expect(@key.title).to eq("narkoz@helium")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".labels" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/labels", "labels")
|
7
|
-
@labels = Gitlab.labels(3)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/labels")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns 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 "gets 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 "returns 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 "gets 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 "returns 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 "gets 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 "returns information about a created label" do
|
64
|
-
expect(@label.name).to eq('Backlog')
|
65
|
-
expect(@label.color).to eq('#DD10AA')
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe ".subscribe_to_label" do
|
70
|
-
before do
|
71
|
-
stub_post("/projects/3/labels/Backlog/subscribe", "label")
|
72
|
-
@label = Gitlab.subscribe_to_label(3, 'Backlog')
|
73
|
-
end
|
74
|
-
|
75
|
-
it "gets the correct resource" do
|
76
|
-
expect(a_post("/projects/3/labels/Backlog/subscribe")).to have_been_made
|
77
|
-
end
|
78
|
-
|
79
|
-
it "returns information about the label subscribed to" do
|
80
|
-
expect(@label.name).to eq('Backlog')
|
81
|
-
expect(@label.subscribed).to eq(true)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe ".unsubscribe_from_label" do
|
86
|
-
before do
|
87
|
-
stub_post("/projects/3/labels/Backlog/unsubscribe", "label_unsubscribe")
|
88
|
-
@label = Gitlab.unsubscribe_from_label(3, 'Backlog')
|
89
|
-
end
|
90
|
-
|
91
|
-
it "gets the correct resource" do
|
92
|
-
expect(a_post("/projects/3/labels/Backlog/unsubscribe")).to have_been_made
|
93
|
-
end
|
94
|
-
|
95
|
-
it "returns information about the label subscribed to" do
|
96
|
-
expect(@label.name).to eq('Backlog')
|
97
|
-
expect(@label.subscribed).to eq(false)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
@@ -1,351 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".user_merge_requests" do
|
5
|
-
before do
|
6
|
-
stub_get("/merge_requests", "merge_requests")
|
7
|
-
@user_merge_requests = Gitlab.user_merge_requests
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/merge_requests")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a paginated response of user merge requests" do
|
15
|
-
expect(@user_merge_requests).to be_a Gitlab::PaginatedResponse
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".merge_requests" do
|
20
|
-
before do
|
21
|
-
stub_get("/projects/3/merge_requests", "merge_requests")
|
22
|
-
@merge_requests = Gitlab.merge_requests(3)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets the correct resource" do
|
26
|
-
expect(a_get("/projects/3/merge_requests")).to have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns a paginated response of project's merge requests" do
|
30
|
-
expect(@merge_requests).to be_a Gitlab::PaginatedResponse
|
31
|
-
expect(@merge_requests.first.project_id).to eq(3)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe ".merge_request" do
|
36
|
-
before do
|
37
|
-
stub_get("/projects/3/merge_requests/1", "merge_request")
|
38
|
-
@merge_request = Gitlab.merge_request(3, 1)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "gets the correct resource" do
|
42
|
-
expect(a_get("/projects/3/merge_requests/1")).to have_been_made
|
43
|
-
end
|
44
|
-
|
45
|
-
it "returns information about a merge request" do
|
46
|
-
expect(@merge_request.project_id).to eq(3)
|
47
|
-
expect(@merge_request.assignee.name).to eq("Jack Smith")
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe ".create_merge_request" do
|
52
|
-
before do
|
53
|
-
stub_post("/projects/3/merge_requests", "merge_request")
|
54
|
-
end
|
55
|
-
|
56
|
-
it "returns information about a merge request" do
|
57
|
-
@merge_request = Gitlab.create_merge_request(3, 'New feature',
|
58
|
-
source_branch: 'api',
|
59
|
-
target_branch: 'master'
|
60
|
-
)
|
61
|
-
expect(@merge_request.project_id).to eq(3)
|
62
|
-
expect(@merge_request.assignee.name).to eq("Jack Smith")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe ".update_merge_request" do
|
67
|
-
before do
|
68
|
-
stub_put("/projects/3/merge_requests/2", "merge_request").
|
69
|
-
with(body: {
|
70
|
-
assignee_id: '1',
|
71
|
-
target_branch: 'master',
|
72
|
-
title: 'A different new feature'
|
73
|
-
})
|
74
|
-
@merge_request = Gitlab.update_merge_request(3, 2,
|
75
|
-
assignee_id: '1',
|
76
|
-
target_branch: 'master',
|
77
|
-
title: 'A different new feature'
|
78
|
-
)
|
79
|
-
end
|
80
|
-
|
81
|
-
it "gets the correct resource" do
|
82
|
-
expect(a_put("/projects/3/merge_requests/2").
|
83
|
-
with(body: {
|
84
|
-
assignee_id: '1',
|
85
|
-
target_branch: 'master',
|
86
|
-
title: 'A different new feature'
|
87
|
-
})).to have_been_made
|
88
|
-
end
|
89
|
-
|
90
|
-
it "returns information about a merge request" do
|
91
|
-
expect(@merge_request.project_id).to eq(3)
|
92
|
-
expect(@merge_request.assignee.name).to eq("Jack Smith")
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe ".accept_merge_request" do
|
97
|
-
before do
|
98
|
-
stub_put("/projects/5/merge_requests/42/merge", "merge_request").
|
99
|
-
with(body: { merge_commit_message: 'Nice!' })
|
100
|
-
@merge_request = Gitlab.accept_merge_request(5, 42, merge_commit_message: 'Nice!')
|
101
|
-
end
|
102
|
-
|
103
|
-
it "gets the correct resource" do
|
104
|
-
expect(a_put("/projects/5/merge_requests/42/merge").
|
105
|
-
with(body: { merge_commit_message: 'Nice!' })).to have_been_made
|
106
|
-
end
|
107
|
-
|
108
|
-
it "returns information about merged merge request" do
|
109
|
-
expect(@merge_request.project_id).to eq(3)
|
110
|
-
expect(@merge_request.assignee.name).to eq("Jack Smith")
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe ".merge_request_comments" do
|
115
|
-
before do
|
116
|
-
stub_get("/projects/3/merge_requests/2/notes", "merge_request_comments")
|
117
|
-
@merge_request = Gitlab.merge_request_comments(3, 2)
|
118
|
-
end
|
119
|
-
|
120
|
-
it "gets the correct resource" do
|
121
|
-
expect(a_get("/projects/3/merge_requests/2/notes")).to have_been_made
|
122
|
-
end
|
123
|
-
|
124
|
-
it "returns merge request's comments" do
|
125
|
-
expect(@merge_request).to be_an Gitlab::PaginatedResponse
|
126
|
-
expect(@merge_request.length).to eq(2)
|
127
|
-
expect(@merge_request[0].note).to eq("this is the 1st comment on the 2merge merge request")
|
128
|
-
expect(@merge_request[0].author.id).to eq(11)
|
129
|
-
expect(@merge_request[1].note).to eq("another discussion point on the 2merge request")
|
130
|
-
expect(@merge_request[1].author.id).to eq(12)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe ".create_merge_request_comment" do
|
135
|
-
before do
|
136
|
-
stub_post("/projects/3/merge_requests/2/notes", "merge_request_comment")
|
137
|
-
@merge_request = Gitlab.create_merge_request_comment(3, 2, 'Cool Merge Request!')
|
138
|
-
end
|
139
|
-
|
140
|
-
it "gets the correct resource" do
|
141
|
-
expect(a_post("/projects/3/merge_requests/2/notes")).to have_been_made
|
142
|
-
end
|
143
|
-
|
144
|
-
it "returns information about a merge request" do
|
145
|
-
expect(@merge_request.note).to eq('Cool Merge Request!')
|
146
|
-
expect(@merge_request.author.id).to eq(1)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
describe ".merge_request_changes" do
|
151
|
-
before do
|
152
|
-
stub_get("/projects/3/merge_requests/2/changes", "merge_request_changes")
|
153
|
-
@mr_changes = Gitlab.merge_request_changes(3, 2)
|
154
|
-
end
|
155
|
-
|
156
|
-
it "gets the correct resource" do
|
157
|
-
expect(a_get("/projects/3/merge_requests/2/changes")).to have_been_made
|
158
|
-
end
|
159
|
-
|
160
|
-
it "returns the merge request changes" do
|
161
|
-
expect(@mr_changes.changes).to be_a Array
|
162
|
-
expect(@mr_changes.changes.first['old_path']).to eq('lib/omniauth/builder.rb')
|
163
|
-
expect(@mr_changes.id).to eq(2)
|
164
|
-
expect(@mr_changes.project_id).to eq(3)
|
165
|
-
expect(@mr_changes.source_branch).to eq('uncovered')
|
166
|
-
expect(@mr_changes.target_branch).to eq('master')
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
describe ".merge_request_commits" do
|
171
|
-
before do
|
172
|
-
stub_get("/projects/3/merge_requests/2/commits", "merge_request_commits")
|
173
|
-
@mr_commits = Gitlab.merge_request_commits(3, 2)
|
174
|
-
end
|
175
|
-
|
176
|
-
it "gets the correct resource" do
|
177
|
-
expect(a_get("/projects/3/merge_requests/2/commits")).to have_been_made
|
178
|
-
end
|
179
|
-
|
180
|
-
it "returns the merge request commits" do
|
181
|
-
expect(@mr_commits).to be_a Gitlab::PaginatedResponse
|
182
|
-
expect(@mr_commits.size).to eq 2
|
183
|
-
expect(@mr_commits.first.id).to eq "a2da7552f26d5b46a6a09bb8b7b066e3a102be7d"
|
184
|
-
expect(@mr_commits.first.short_id).to eq "a2da7552"
|
185
|
-
expect(@mr_commits.first.title).to eq "piyo"
|
186
|
-
expect(@mr_commits.first.author_name).to eq "example"
|
187
|
-
expect(@mr_commits.first.author_email).to eq "example@example.com"
|
188
|
-
expect(@mr_commits[1].short_id).to eq "3ce50959"
|
189
|
-
expect(@mr_commits[1].title).to eq "hoge"
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
describe ".merge_request_closes_issues" do
|
194
|
-
before do
|
195
|
-
stub_get("/projects/5/merge_requests/1/closes_issues", "merge_request_closes_issues")
|
196
|
-
@issues = Gitlab.merge_request_closes_issues(5, 1)
|
197
|
-
end
|
198
|
-
|
199
|
-
it "gets the correct resource" do
|
200
|
-
expect(a_get("/projects/5/merge_requests/1/closes_issues")).to have_been_made
|
201
|
-
end
|
202
|
-
|
203
|
-
it "returns a paginated response of the issues the merge_request will close" do
|
204
|
-
expect(@issues).to be_a(Gitlab::PaginatedResponse)
|
205
|
-
expect(@issues.first.title).to eq("Merge request 1 issue 1")
|
206
|
-
expect(@issues.size).to eq(2)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
describe ".subscribe_to_merge_request" do
|
211
|
-
before do
|
212
|
-
stub_post("/projects/3/merge_requests/2/subscribe", "merge_request")
|
213
|
-
@merge_request = Gitlab.subscribe_to_merge_request(3, 2)
|
214
|
-
end
|
215
|
-
|
216
|
-
it "gets the correct resource" do
|
217
|
-
expect(a_post("/projects/3/merge_requests/2/subscribe")).to have_been_made
|
218
|
-
end
|
219
|
-
|
220
|
-
it "returns information about a merge request" do
|
221
|
-
expect(@merge_request.project_id).to eq(3)
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
describe ".unsubscribe_from_merge_request" do
|
226
|
-
before do
|
227
|
-
stub_post("/projects/3/merge_requests/2/unsubscribe", "merge_request")
|
228
|
-
@merge_request = Gitlab.unsubscribe_from_merge_request(3, 2)
|
229
|
-
end
|
230
|
-
|
231
|
-
it "gets the correct resource" do
|
232
|
-
expect(a_post("/projects/3/merge_requests/2/unsubscribe")).to have_been_made
|
233
|
-
end
|
234
|
-
|
235
|
-
it "returns information about a merge request" do
|
236
|
-
expect(@merge_request.project_id).to eq(3)
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
describe ".merge_request_discussions" do
|
241
|
-
before do
|
242
|
-
stub_get("/projects/3/merge_requests/2/discussions", "merge_request_discussions")
|
243
|
-
@discussions = Gitlab.merge_request_discussions(3, 2)
|
244
|
-
end
|
245
|
-
|
246
|
-
it "gets the correct resource" do
|
247
|
-
expect(a_get("/projects/3/merge_requests/2/discussions")).to have_been_made
|
248
|
-
end
|
249
|
-
|
250
|
-
it "returns information about the discussions" do
|
251
|
-
expect(@discussions.length).to eq(1)
|
252
|
-
expect(@discussions.first.id).to eq('7d66bf19bf835e6a4666130544ba1b5c343fc705')
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
describe ".merge_request_discussion" do
|
257
|
-
before do
|
258
|
-
stub_get("/projects/3/merge_requests/2/discussions/1", "merge_request_discussion")
|
259
|
-
@discussion = Gitlab.merge_request_discussion(3, 2, 1)
|
260
|
-
end
|
261
|
-
|
262
|
-
it "gets the correct resource" do
|
263
|
-
expect(a_get("/projects/3/merge_requests/2/discussions/1")).to have_been_made
|
264
|
-
end
|
265
|
-
|
266
|
-
it "returns information about the discussions" do
|
267
|
-
expect(@discussion.id).to eq('7d66bf19bf835e6a4666130544ba1b5c343fc705')
|
268
|
-
end
|
269
|
-
end
|
270
|
-
|
271
|
-
describe ".create_merge_request_discussion" do
|
272
|
-
before do
|
273
|
-
stub_post("/projects/3/merge_requests/2/discussions", "merge_request_discussion")
|
274
|
-
@discussion = Gitlab.create_merge_request_discussion(3, 2, body: 'Discussion', position: {old_line: 1})
|
275
|
-
end
|
276
|
-
|
277
|
-
it "posts the correct resource" do
|
278
|
-
expect(a_post("/projects/3/merge_requests/2/discussions").
|
279
|
-
with(body: 'body=Discussion&position[old_line]=1')).to have_been_made
|
280
|
-
end
|
281
|
-
|
282
|
-
it "returns information about the discussions" do
|
283
|
-
expect(@discussion.id).to eq('7d66bf19bf835e6a4666130544ba1b5c343fc705')
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
describe ".resolve_merge_request_discussion" do
|
288
|
-
before do
|
289
|
-
stub_put("/projects/3/merge_requests/2/discussions/1", "merge_request_discussion")
|
290
|
-
@discussion = Gitlab.resolve_merge_request_discussion(3, 2, 1, resolved: true)
|
291
|
-
end
|
292
|
-
|
293
|
-
it "puts the correct resource" do
|
294
|
-
expect(a_put("/projects/3/merge_requests/2/discussions/1").
|
295
|
-
with(body: 'resolved=true')).to have_been_made
|
296
|
-
end
|
297
|
-
|
298
|
-
it "returns information about the discussions" do
|
299
|
-
expect(@discussion.id).to eq('7d66bf19bf835e6a4666130544ba1b5c343fc705')
|
300
|
-
note = @discussion.notes.first
|
301
|
-
expect(note['id']).to eq(1758)
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
describe ".create_merge_request_discussion_note" do
|
306
|
-
before do
|
307
|
-
stub_post("/projects/3/merge_requests/2/discussions/1/notes", "merge_request_discussion_note")
|
308
|
-
@note = Gitlab.create_merge_request_discussion_note(3, 2, 1, body: 'note')
|
309
|
-
end
|
310
|
-
|
311
|
-
it "posts the correct resource" do
|
312
|
-
expect(a_post("/projects/3/merge_requests/2/discussions/1/notes").
|
313
|
-
with(body: 'body=note')).to have_been_made
|
314
|
-
end
|
315
|
-
|
316
|
-
it "returns information about the note" do
|
317
|
-
expect(@note.id).to eq(1775)
|
318
|
-
end
|
319
|
-
end
|
320
|
-
|
321
|
-
describe ".update_merge_request_discussion_note" do
|
322
|
-
before do
|
323
|
-
stub_put("/projects/3/merge_requests/2/discussions/1/notes/1", "merge_request_discussion_note")
|
324
|
-
@note = Gitlab.update_merge_request_discussion_note(3, 2, 1, 1, body: 'note2')
|
325
|
-
end
|
326
|
-
|
327
|
-
it "puts the correct resource" do
|
328
|
-
expect(a_put("/projects/3/merge_requests/2/discussions/1/notes/1").
|
329
|
-
with(body: 'body=note2')).to have_been_made
|
330
|
-
end
|
331
|
-
|
332
|
-
it "returns information about the note" do
|
333
|
-
expect(@note.id).to eq(1775)
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
describe ".delete_merge_request_discussion_note" do
|
338
|
-
before do
|
339
|
-
stub_request(:delete, "https://api.example.com/projects/3/merge_requests/2/discussions/1/notes/1").to_return(body: '')
|
340
|
-
@note = Gitlab.delete_merge_request_discussion_note(3, 2, 1, 1)
|
341
|
-
end
|
342
|
-
|
343
|
-
it "deletes the correct resource" do
|
344
|
-
expect(a_delete("/projects/3/merge_requests/2/discussions/1/notes/1")).to have_been_made
|
345
|
-
end
|
346
|
-
|
347
|
-
it "returns nothing" do
|
348
|
-
expect(@note).to be_falsy
|
349
|
-
end
|
350
|
-
end
|
351
|
-
end
|