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,94 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
it { is_expected.to respond_to :repo_tags }
|
5
|
-
it { is_expected.to respond_to :repo_create_tag }
|
6
|
-
it { is_expected.to respond_to :repo_branches }
|
7
|
-
it { is_expected.to respond_to :repo_branch }
|
8
|
-
it { is_expected.to respond_to :repo_tree }
|
9
|
-
it { is_expected.to respond_to :repo_compare }
|
10
|
-
|
11
|
-
describe ".tags" do
|
12
|
-
before do
|
13
|
-
stub_get("/projects/3/repository/tags", "project_tags")
|
14
|
-
@tags = Gitlab.tags(3)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "gets the correct resource" do
|
18
|
-
expect(a_get("/projects/3/repository/tags")).to have_been_made
|
19
|
-
end
|
20
|
-
|
21
|
-
it "returns a paginated response of repository tags" do
|
22
|
-
expect(@tags).to be_a Gitlab::PaginatedResponse
|
23
|
-
expect(@tags.first.name).to eq("v2.8.2")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe ".create_tag" do
|
28
|
-
context "when lightweight" do
|
29
|
-
before do
|
30
|
-
stub_post("/projects/3/repository/tags", "project_tag_lightweight")
|
31
|
-
@tag = Gitlab.create_tag(3, 'v1.0.0', '2695effb5807a22ff3d138d593fd856244e155e7')
|
32
|
-
end
|
33
|
-
|
34
|
-
it "gets the correct resource" do
|
35
|
-
expect(a_post("/projects/3/repository/tags")).to have_been_made
|
36
|
-
end
|
37
|
-
|
38
|
-
it "returns information about a new repository tag" do
|
39
|
-
expect(@tag.name).to eq("v1.0.0")
|
40
|
-
expect(@tag.message).to eq(nil)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context "when annotated" do
|
45
|
-
before do
|
46
|
-
stub_post("/projects/3/repository/tags", "project_tag_annotated")
|
47
|
-
@tag = Gitlab.create_tag(3, 'v1.1.0', '2695effb5807a22ff3d138d593fd856244e155e7', 'Release 1.1.0')
|
48
|
-
end
|
49
|
-
|
50
|
-
it "gets the correct resource" do
|
51
|
-
expect(a_post("/projects/3/repository/tags")).to have_been_made
|
52
|
-
end
|
53
|
-
|
54
|
-
it "returns information about a new repository tag" do
|
55
|
-
expect(@tag.name).to eq("v1.1.0")
|
56
|
-
expect(@tag.message).to eq("Release 1.1.0")
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe ".tree" do
|
62
|
-
before do
|
63
|
-
stub_get("/projects/3/repository/tree", "tree")
|
64
|
-
@tree = Gitlab.tree(3)
|
65
|
-
end
|
66
|
-
|
67
|
-
it "gets the correct resource" do
|
68
|
-
expect(a_get("/projects/3/repository/tree")).to have_been_made
|
69
|
-
end
|
70
|
-
|
71
|
-
it "returns a paginated response of repository tree files (root level)" do
|
72
|
-
expect(@tree).to be_a Gitlab::PaginatedResponse
|
73
|
-
expect(@tree.first.name).to eq("app")
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe ".compare" do
|
78
|
-
before do
|
79
|
-
stub_get("/projects/3/repository/compare", "compare_merge_request_diff").
|
80
|
-
with(query: { from: "master", to: "feature" })
|
81
|
-
@diff = Gitlab.compare(3, 'master', 'feature')
|
82
|
-
end
|
83
|
-
|
84
|
-
it "gets the correct resource" do
|
85
|
-
expect(a_get("/projects/3/repository/compare").
|
86
|
-
with(query: { from: "master", to: "feature" })).to have_been_made
|
87
|
-
end
|
88
|
-
|
89
|
-
it "gets diffs of a merge request" do
|
90
|
-
expect(@diff.diffs).to be_kind_of Array
|
91
|
-
expect(@diff.diffs.last["new_path"]).to eq "files/js/application.js"
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".file_contents" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/repository/files/Gemfile/raw?ref=master", "raw_file")
|
7
|
-
@file_contents = Gitlab.file_contents(3, "Gemfile")
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/repository/files/Gemfile/raw?ref=master")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns file contents" do
|
15
|
-
expect(@file_contents).to eq("source 'https://rubygems.org'\ngem 'rails', '4.1.2'\n")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".get_file" do
|
20
|
-
before do
|
21
|
-
stub_get("/projects/3/repository/files/README%2Emd?ref=master", "get_repository_file")
|
22
|
-
@file = Gitlab.get_file(3, 'README.md', 'master')
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets the correct resource" do
|
26
|
-
expect(a_get("/projects/3/repository/files/README%2Emd?ref=master")).to have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns the base64 encoded file" do
|
30
|
-
expect(@file.file_path).to eq "README.md"
|
31
|
-
expect(@file.ref).to eq "master"
|
32
|
-
expect(@file.content).to eq "VGhpcyBpcyBhICpSRUFETUUqIQ==\n"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe ".create_file" do
|
37
|
-
let(:api_path) { "/projects/3/repository/files/path" }
|
38
|
-
let!(:request_stub) { stub_post(api_path, "repository_file") }
|
39
|
-
let!(:file) { Gitlab.create_file(3, "path", "branch", "content", "commit message", author_name: "joe") }
|
40
|
-
|
41
|
-
it "creates the correct resource" do
|
42
|
-
expected_parameters = {
|
43
|
-
author_name: "joe",
|
44
|
-
branch: "branch",
|
45
|
-
commit_message: "commit message"
|
46
|
-
}
|
47
|
-
expect(a_post(api_path).with(body: hash_including(expected_parameters))).to have_been_made
|
48
|
-
end
|
49
|
-
|
50
|
-
it "returns information about the new file" do
|
51
|
-
expect(file.file_path).to eq "path"
|
52
|
-
expect(file.branch_name).to eq "branch"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe ".edit_file" do
|
57
|
-
let(:api_path) { "/projects/3/repository/files/path" }
|
58
|
-
let!(:request_stub) { stub_put(api_path, "repository_file") }
|
59
|
-
let!(:file) { Gitlab.edit_file(3, "path", "branch", "content", "commit message", author_name: "joe") }
|
60
|
-
|
61
|
-
it "updates the correct resource" do
|
62
|
-
expected_parameters = {
|
63
|
-
author_name: "joe",
|
64
|
-
branch: "branch",
|
65
|
-
commit_message: "commit message"
|
66
|
-
}
|
67
|
-
expect(a_put(api_path).with(body: hash_including(expected_parameters))).to have_been_made
|
68
|
-
end
|
69
|
-
|
70
|
-
it "returns information about the new file" do
|
71
|
-
expect(file.file_path).to eq "path"
|
72
|
-
expect(file.branch_name).to eq "branch"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe ".remove_file" do
|
77
|
-
let(:api_path) { "/projects/3/repository/files/path" }
|
78
|
-
let!(:request_stub) { stub_delete(api_path, "repository_file") }
|
79
|
-
let!(:file) { Gitlab.remove_file(3, "path", "branch", "commit message", author_name: "joe") }
|
80
|
-
|
81
|
-
it "updates the correct resource" do
|
82
|
-
expected_parameters = {
|
83
|
-
author_name: "joe",
|
84
|
-
branch: "branch",
|
85
|
-
commit_message: "commit message"
|
86
|
-
}
|
87
|
-
expect(a_delete(api_path).with(body: hash_including(expected_parameters))).to have_been_made
|
88
|
-
end
|
89
|
-
|
90
|
-
it "returns information about the new file" do
|
91
|
-
expect(file.file_path).to eq "path"
|
92
|
-
expect(file.branch_name).to eq "branch"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,193 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
|
5
|
-
describe ".runners" do
|
6
|
-
before do
|
7
|
-
stub_get("/runners", "runners")
|
8
|
-
end
|
9
|
-
|
10
|
-
context 'without scope' do
|
11
|
-
before do
|
12
|
-
@runner = Gitlab.runners
|
13
|
-
end
|
14
|
-
|
15
|
-
it "gets the correct resource" do
|
16
|
-
expect(a_get("/runners")).to have_been_made
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns a paginated response of runners" do
|
20
|
-
expect(@runner).to be_a Gitlab::PaginatedResponse
|
21
|
-
expect(@runner.first.id).to eq(6)
|
22
|
-
expect(@runner.first.description).to eq('test-1-20150125')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'with scope' do
|
27
|
-
before do
|
28
|
-
stub_get("/runners?scope=online", "runners")
|
29
|
-
@runner = Gitlab.runners({scope: :online})
|
30
|
-
end
|
31
|
-
|
32
|
-
it "gets the correct resource" do
|
33
|
-
expect(a_get("/runners").with(query: { scope: :online })).to have_been_made
|
34
|
-
end
|
35
|
-
|
36
|
-
it "returns a paginated response of runners" do
|
37
|
-
expect(@runner).to be_a Gitlab::PaginatedResponse
|
38
|
-
expect(@runner.first.id).to eq(6)
|
39
|
-
expect(@runner.first.description).to eq('test-1-20150125')
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
describe ".all_runners" do
|
46
|
-
before do
|
47
|
-
stub_get("/runners/all", "runners")
|
48
|
-
end
|
49
|
-
|
50
|
-
context 'without scope' do
|
51
|
-
before do
|
52
|
-
@runner = Gitlab.all_runners
|
53
|
-
end
|
54
|
-
|
55
|
-
it "gets the correct resource" do
|
56
|
-
expect(a_get("/runners/all")).to have_been_made
|
57
|
-
end
|
58
|
-
|
59
|
-
it "returns a paginated response of runners" do
|
60
|
-
expect(@runner).to be_a Gitlab::PaginatedResponse
|
61
|
-
expect(@runner.first.id).to eq(6)
|
62
|
-
expect(@runner.first.description).to eq('test-1-20150125')
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context 'with scope' do
|
67
|
-
before do
|
68
|
-
stub_get("/runners/all?scope=online", "runners")
|
69
|
-
@runner = Gitlab.all_runners({scope: :online})
|
70
|
-
end
|
71
|
-
|
72
|
-
it "gets the correct resource" do
|
73
|
-
expect(a_get("/runners/all").with(query: { scope: :online })).to have_been_made
|
74
|
-
end
|
75
|
-
|
76
|
-
it "returns a paginated response of runners" do
|
77
|
-
expect(@runner).to be_a Gitlab::PaginatedResponse
|
78
|
-
expect(@runner.first.id).to eq(6)
|
79
|
-
expect(@runner.first.description).to eq('test-1-20150125')
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe ".runner" do
|
85
|
-
before do
|
86
|
-
stub_get("/runners/6", "runner")
|
87
|
-
@runners = Gitlab.runner(6)
|
88
|
-
end
|
89
|
-
|
90
|
-
it "gets the correct resource" do
|
91
|
-
expect(a_get("/runners/6")).to have_been_made
|
92
|
-
end
|
93
|
-
|
94
|
-
it "returns a response of a runner" do
|
95
|
-
expect(@runners).to be_a Gitlab::ObjectifiedHash
|
96
|
-
expect(@runners.id).to eq(6)
|
97
|
-
expect(@runners.description).to eq('test-1-20150125')
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
describe ".update_runner" do
|
102
|
-
before do
|
103
|
-
stub_put("/runners/6", "runner_edit").with(query: { description: "abcefg" })
|
104
|
-
@runner = Gitlab.update_runner(6, description: "abcefg" )
|
105
|
-
end
|
106
|
-
|
107
|
-
it "gets the correct resource" do
|
108
|
-
expect(a_put("/runners/6").with(query: { description: "abcefg" })).to have_been_made
|
109
|
-
end
|
110
|
-
|
111
|
-
it "returns an updated response of a runner" do
|
112
|
-
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
113
|
-
expect(@runner.description).to eq('abcefg')
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
describe ".delete_runner" do
|
118
|
-
before do
|
119
|
-
stub_delete("/runners/6", "runner_delete")
|
120
|
-
@runner = Gitlab.delete_runner(6)
|
121
|
-
end
|
122
|
-
|
123
|
-
it "gets the correct resource" do
|
124
|
-
expect(a_delete("/runners/6")).to have_been_made
|
125
|
-
end
|
126
|
-
|
127
|
-
it "returns a response of the deleted runner" do
|
128
|
-
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
129
|
-
expect(@runner.id).to eq(6)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
describe '.runner_jobs' do
|
134
|
-
before do
|
135
|
-
stub_get('/runners/1/jobs', 'runner_jobs')
|
136
|
-
@jobs = Gitlab.runner_jobs(1)
|
137
|
-
end
|
138
|
-
it 'gets the correct resource' do
|
139
|
-
expect(a_get('/runners/1/jobs')).to have_been_made
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe ".project_runners" do
|
144
|
-
before do
|
145
|
-
stub_get("/projects/1/runners", "project_runners")
|
146
|
-
@runners = Gitlab.project_runners(1)
|
147
|
-
end
|
148
|
-
|
149
|
-
it "gets the correct resource" do
|
150
|
-
expect(a_get("/projects/1/runners")).to have_been_made
|
151
|
-
end
|
152
|
-
|
153
|
-
it "returns a paginated response of runners" do
|
154
|
-
expect(@runners).to be_a Gitlab::PaginatedResponse
|
155
|
-
expect(@runners.first.id).to eq(8)
|
156
|
-
expect(@runners.first.description).to eq('test-2-20150125')
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
describe ".project_enable_runner" do
|
161
|
-
before do
|
162
|
-
stub_post("/projects/1/runners", "runner")
|
163
|
-
@runner = Gitlab.project_enable_runner(1, 6)
|
164
|
-
end
|
165
|
-
|
166
|
-
it "gets the correct resource" do
|
167
|
-
expect(a_post("/projects/1/runners")).to have_been_made
|
168
|
-
end
|
169
|
-
|
170
|
-
it "returns a response of the enabled runner" do
|
171
|
-
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
172
|
-
expect(@runner.id).to eq(6)
|
173
|
-
expect(@runner.description).to eq('test-1-20150125')
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
describe ".project_disable_runner" do
|
178
|
-
before do
|
179
|
-
stub_delete("/projects/1/runners/6", "runner")
|
180
|
-
@runner = Gitlab.project_disable_runner(1, 6)
|
181
|
-
end
|
182
|
-
|
183
|
-
it "gets the correct resource" do
|
184
|
-
expect(a_delete("/projects/1/runners/6")).to have_been_made
|
185
|
-
end
|
186
|
-
|
187
|
-
it "returns a response of the disabled runner" do
|
188
|
-
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
189
|
-
expect(@runner.id).to eq(6)
|
190
|
-
expect(@runner.description).to eq('test-1-20150125')
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".service" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/services/redmine", "service")
|
7
|
-
@service = Gitlab.service(3, :redmine)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/services/redmine")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a information about a service of project" do
|
15
|
-
expect(@service.id).to eq 38
|
16
|
-
expect(@service.title).to eq("Redmine")
|
17
|
-
expect(@service.properties.project_url).to eq("https://example.com/projects/test_project/issue")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe ".change_service" do
|
22
|
-
before do
|
23
|
-
stub_put("/projects/3/services/redmine", "service")
|
24
|
-
@service = Gitlab.change_service(3, :redmine, new_issue_url: 'https://example.com/projects/test_project/issues/new',
|
25
|
-
project_url: 'https://example.com/projects/test_project/issues',
|
26
|
-
issues_url: 'https://example.com/issues/:id')
|
27
|
-
end
|
28
|
-
|
29
|
-
it "gets the correct resource" do
|
30
|
-
body = {new_issue_url: 'https://example.com/projects/test_project/issues/new',
|
31
|
-
project_url: 'https://example.com/projects/test_project/issues',
|
32
|
-
issues_url: 'https://example.com/issues/:id'}
|
33
|
-
expect(a_put("/projects/3/services/redmine").with(body: body)).to have_been_made
|
34
|
-
end
|
35
|
-
|
36
|
-
it "returns information about a new service" do
|
37
|
-
expect(@service).to be_truthy
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe ".delete_servoce" do
|
42
|
-
before do
|
43
|
-
stub_delete("/projects/3/services/redmine", "service")
|
44
|
-
@service = Gitlab.delete_service(3, :redmine)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "gets the correct resource" do
|
48
|
-
expect(a_delete("/projects/3/services/redmine")).to have_been_made
|
49
|
-
end
|
50
|
-
|
51
|
-
it "returns information about a deleted service" do
|
52
|
-
expect(@service).to be_truthy
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".sidekiq_queue_metrics" do
|
5
|
-
before do
|
6
|
-
stub_get("/sidekiq/queue_metrics", 'sidekiq_queue_metrics')
|
7
|
-
@sidekiq_queue_metrics = Gitlab.sidekiq_queue_metrics
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/sidekiq/queue_metrics")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a information about a sidekiq default queue" do
|
15
|
-
expect(@sidekiq_queue_metrics.queues.default.backlog).to eq 0
|
16
|
-
expect(@sidekiq_queue_metrics.queues.default.latency).to eq 0
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe ".sidekiq_process_metrics" do
|
21
|
-
before do
|
22
|
-
stub_get("/sidekiq/process_metrics", 'sidekiq_process_metrics')
|
23
|
-
@sidekiq_process_metrics = Gitlab.sidekiq_process_metrics
|
24
|
-
end
|
25
|
-
|
26
|
-
it "gets the correct resource" do
|
27
|
-
expect(a_get("/sidekiq/process_metrics")).to have_been_made
|
28
|
-
end
|
29
|
-
|
30
|
-
it "returns a information about a sidekiq process metrics" do
|
31
|
-
expect(@sidekiq_process_metrics.processes.first['busy']).to eq 0
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe ".sidekiq_job_stats" do
|
36
|
-
before do
|
37
|
-
stub_get("/sidekiq/job_stats", 'sidekiq_job_stats')
|
38
|
-
@sidekiq_job_stats = Gitlab.sidekiq_job_stats
|
39
|
-
end
|
40
|
-
|
41
|
-
it "gets the correct resource" do
|
42
|
-
expect(a_get("/sidekiq/job_stats")).to have_been_made
|
43
|
-
end
|
44
|
-
|
45
|
-
it "returns a information about a sidekiq process metrics" do
|
46
|
-
expect(@sidekiq_job_stats.jobs.processed).to eq 2
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe ".sidekiq_compound_metrics" do
|
51
|
-
before do
|
52
|
-
stub_get("/sidekiq/compound_metrics", 'sidekiq_compound_metrics')
|
53
|
-
@sidekiq_compound_metrics = Gitlab.sidekiq_compound_metrics
|
54
|
-
end
|
55
|
-
|
56
|
-
it "gets the correct resource" do
|
57
|
-
expect(a_get("/sidekiq/compound_metrics")).to have_been_made
|
58
|
-
end
|
59
|
-
|
60
|
-
it "returns a information about a sidekiq process metrics" do
|
61
|
-
expect(@sidekiq_compound_metrics.jobs.processed).to eq 2
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|