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
|
-
describe ".boards" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/boards", "boards")
|
7
|
-
@boards = Gitlab.boards(3)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/boards")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a paginated response of project's boards" do
|
15
|
-
expect(@boards).to be_a Gitlab::PaginatedResponse
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".board_lists" do
|
20
|
-
before do
|
21
|
-
stub_get("/projects/3/boards/1/lists", "board_lists")
|
22
|
-
@board_lists = Gitlab.board_lists(3, 1)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets the correct resource" do
|
26
|
-
expect(a_get("/projects/3/boards/1/lists")).to have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns a paginated response of board's lists" do
|
30
|
-
expect(@board_lists).to be_a Gitlab::PaginatedResponse
|
31
|
-
expect(@board_lists.first.id).to eq(1)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe ".board_list" do
|
36
|
-
before do
|
37
|
-
stub_get("/projects/3/boards/1/lists/1", "board_list")
|
38
|
-
@board_list = Gitlab.board_list(3, 1, 1)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "gets the correct resource" do
|
42
|
-
expect(a_get("/projects/3/boards/1/lists/1")).to have_been_made
|
43
|
-
end
|
44
|
-
|
45
|
-
it "returns information about the list" do
|
46
|
-
expect(@board_list.id).to eq(1)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe ".create_board_list" do
|
51
|
-
before do
|
52
|
-
stub_post("/projects/3/boards/1/lists", "board_list")
|
53
|
-
@board_list = Gitlab.create_board_list(3, 1, 4)
|
54
|
-
end
|
55
|
-
|
56
|
-
it "gets the correct resource" do
|
57
|
-
expect(a_post("/projects/3/boards/1/lists")).to have_been_made
|
58
|
-
end
|
59
|
-
|
60
|
-
it "returns information about a created board" do
|
61
|
-
expect(@board_list.position).to eq(1)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe ".edit_board_list" do
|
66
|
-
before do
|
67
|
-
stub_put("/projects/3/boards/1/lists/1", "board_list")
|
68
|
-
@board_list = Gitlab.edit_board_list(3, 1, 1, 3)
|
69
|
-
end
|
70
|
-
|
71
|
-
it "gets the correct resource" do
|
72
|
-
expect(a_put("/projects/3/boards/1/lists/1")).to have_been_made
|
73
|
-
end
|
74
|
-
|
75
|
-
it "returns information about an edited board" do
|
76
|
-
expect(@board_list.id).to eq(1)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe ".delete_board_list" do
|
81
|
-
before do
|
82
|
-
stub_delete("/projects/3/boards/1/lists/1", "board_list")
|
83
|
-
@board_list = Gitlab.delete_board_list(3, 1, 1)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "gets the correct resource" do
|
87
|
-
expect(a_delete("/projects/3/boards/1/lists/1")).to have_been_made
|
88
|
-
end
|
89
|
-
|
90
|
-
it "returns information about the deleted board list" do
|
91
|
-
expect(@board_list.id).to eq(1)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,118 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
it { is_expected.to respond_to :repo_branches }
|
5
|
-
it { is_expected.to respond_to :repo_branch }
|
6
|
-
it { is_expected.to respond_to :repo_protect_branch }
|
7
|
-
it { is_expected.to respond_to :repo_unprotect_branch }
|
8
|
-
|
9
|
-
describe ".branches" do
|
10
|
-
before do
|
11
|
-
stub_get("/projects/3/repository/branches", "branches")
|
12
|
-
@branches = Gitlab.branches(3)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "gets the correct resource" do
|
16
|
-
expect(a_get("/projects/3/repository/branches")).to have_been_made
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns a paginated response of repository branches" do
|
20
|
-
expect(@branches).to be_a Gitlab::PaginatedResponse
|
21
|
-
expect(@branches.first.name).to eq("api")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe ".branch" do
|
26
|
-
before do
|
27
|
-
stub_get("/projects/3/repository/branches/api", "branch")
|
28
|
-
@branch = Gitlab.branch(3, "api")
|
29
|
-
end
|
30
|
-
|
31
|
-
it "gets the correct resource" do
|
32
|
-
expect(a_get("/projects/3/repository/branches/api")).to have_been_made
|
33
|
-
end
|
34
|
-
|
35
|
-
it "returns information about a repository branch" do
|
36
|
-
expect(@branch.name).to eq("api")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe ".protect_branch" do
|
41
|
-
before do
|
42
|
-
stub_post("/projects/3/protected_branches", "branch")
|
43
|
-
end
|
44
|
-
|
45
|
-
context "without options" do
|
46
|
-
before do
|
47
|
-
@branch = Gitlab.protect_branch(3, "api")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "updates the correct resource" do
|
51
|
-
expect(a_post("/projects/3/protected_branches")).to have_been_made
|
52
|
-
end
|
53
|
-
|
54
|
-
it "returns information about a protected repository branch" do
|
55
|
-
expect(@branch.name).to eq("api")
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context "with options" do
|
60
|
-
before do
|
61
|
-
@branch = Gitlab.protect_branch(3, "api", developers_can_push: true)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "updates the correct resource with the correct options" do
|
65
|
-
expect(
|
66
|
-
a_post("/projects/3/protected_branches").with(body: { name: "api", developers_can_push: 'true' })
|
67
|
-
).to have_been_made
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe ".unprotect_branch" do
|
73
|
-
before do
|
74
|
-
stub_delete("/projects/3/protected_branches/api","branch")
|
75
|
-
@branch = Gitlab.unprotect_branch(3, "api")
|
76
|
-
end
|
77
|
-
|
78
|
-
it "gets the correct resource" do
|
79
|
-
expect(a_delete("/projects/3/protected_branches/api")).to have_been_made
|
80
|
-
end
|
81
|
-
|
82
|
-
it "returns information about an unprotected repository branch" do
|
83
|
-
expect(@branch.name).to eq("api")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
describe ".create_branch" do
|
88
|
-
before do
|
89
|
-
stub_post("/projects/3/repository/branches", "branch").with(query: { branch: 'api', ref: "master"})
|
90
|
-
@branch = Gitlab.create_branch(3, "api", "master")
|
91
|
-
end
|
92
|
-
|
93
|
-
it "gets the correct resource" do
|
94
|
-
expect(
|
95
|
-
a_post("/projects/3/repository/branches").with(query: { branch: 'api', ref: "master"})
|
96
|
-
).to have_been_made
|
97
|
-
end
|
98
|
-
|
99
|
-
it "returns information about a new repository branch" do
|
100
|
-
expect(@branch.name).to eq("api")
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe ".delete_branch" do
|
105
|
-
before do
|
106
|
-
stub_delete("/projects/3/repository/branches/api", "branch_delete")
|
107
|
-
@branch = Gitlab.delete_branch(3, "api")
|
108
|
-
end
|
109
|
-
|
110
|
-
it "gets the correct resource" do
|
111
|
-
expect(a_delete("/projects/3/repository/branches/api")).to have_been_made
|
112
|
-
end
|
113
|
-
|
114
|
-
it "returns information about the deleted repository branch" do
|
115
|
-
expect(@branch.branch_name).to eq("api")
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
@@ -1,169 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".variables" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/variables", "variables")
|
7
|
-
@variables = Gitlab.variables(3)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/variables")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns an array of project's variables" do
|
15
|
-
expect(@variables).to be_a Gitlab::PaginatedResponse
|
16
|
-
expect(@variables.first.key).to eq("TEST_VARIABLE_1")
|
17
|
-
expect(@variables.first.value).to eq("TEST_1")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe ".variable" do
|
22
|
-
before do
|
23
|
-
stub_get("/projects/3/variables/VARIABLE", "variable")
|
24
|
-
@variable = Gitlab.variable(3, "VARIABLE")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "gets the correct resource" do
|
28
|
-
expect(a_get("/projects/3/variables/VARIABLE")).to have_been_made
|
29
|
-
end
|
30
|
-
|
31
|
-
it "returns information about a variable" do
|
32
|
-
expect(@variable.key).to eq("VARIABLE")
|
33
|
-
expect(@variable.value).to eq("the value")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe ".create_variable" do
|
38
|
-
before do
|
39
|
-
stub_post("/projects/3/variables", "variable")
|
40
|
-
@variable = Gitlab.create_variable(3, "NEW_VARIABLE", "new value")
|
41
|
-
end
|
42
|
-
|
43
|
-
it "gets the correct resource" do
|
44
|
-
body = { key: "NEW_VARIABLE", value: "new value" }
|
45
|
-
expect(a_post("/projects/3/variables").with(body: body)).to have_been_made
|
46
|
-
end
|
47
|
-
|
48
|
-
it "returns information about a new variable" do
|
49
|
-
expect(@variable.key).to eq("VARIABLE")
|
50
|
-
expect(@variable.value).to eq("the value")
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe ".update_variable" do
|
55
|
-
before do
|
56
|
-
stub_put("/projects/3/variables/UPD_VARIABLE", "variable")
|
57
|
-
@variable = Gitlab.update_variable(3, "UPD_VARIABLE", "updated value")
|
58
|
-
end
|
59
|
-
|
60
|
-
it "puts the correct resource" do
|
61
|
-
body = { value: "updated value" }
|
62
|
-
expect(a_put("/projects/3/variables/UPD_VARIABLE").with(body: body)).to have_been_made
|
63
|
-
end
|
64
|
-
|
65
|
-
it "returns information about an updated variable" do
|
66
|
-
expect(@variable.key).to eq("VARIABLE")
|
67
|
-
expect(@variable.value).to eq("the value")
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe ".remove_variable" do
|
72
|
-
before do
|
73
|
-
stub_delete("/projects/3/variables/DEL_VARIABLE", "variable")
|
74
|
-
@variable = Gitlab.remove_variable(3, "DEL_VARIABLE")
|
75
|
-
end
|
76
|
-
|
77
|
-
it "gets the correct resource" do
|
78
|
-
expect(a_delete("/projects/3/variables/DEL_VARIABLE")).to have_been_made
|
79
|
-
end
|
80
|
-
|
81
|
-
it "returns information about a deleted variable" do
|
82
|
-
expect(@variable.key).to eq("VARIABLE")
|
83
|
-
expect(@variable.value).to eq("the value")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
describe ".group_variables" do
|
88
|
-
before do
|
89
|
-
stub_get("/groups/3/variables", "variables")
|
90
|
-
@variables = Gitlab.group_variables(3)
|
91
|
-
end
|
92
|
-
|
93
|
-
it "gets the correct resource" do
|
94
|
-
expect(a_get("/groups/3/variables")).to have_been_made
|
95
|
-
end
|
96
|
-
|
97
|
-
it "returns an array of group's variables" do
|
98
|
-
expect(@variables).to be_a Gitlab::PaginatedResponse
|
99
|
-
expect(@variables.first.key).to eq("TEST_VARIABLE_1")
|
100
|
-
expect(@variables.first.value).to eq("TEST_1")
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe ".group_variable" do
|
105
|
-
before do
|
106
|
-
stub_get("/groups/3/variables/VARIABLE", "variable")
|
107
|
-
@variable = Gitlab.group_variable(3, "VARIABLE")
|
108
|
-
end
|
109
|
-
|
110
|
-
it "gets the correct resource" do
|
111
|
-
expect(a_get("/groups/3/variables/VARIABLE")).to have_been_made
|
112
|
-
end
|
113
|
-
|
114
|
-
it "returns information about a variable" do
|
115
|
-
expect(@variable.key).to eq("VARIABLE")
|
116
|
-
expect(@variable.value).to eq("the value")
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe ".create_group_variable" do
|
121
|
-
before do
|
122
|
-
stub_post("/groups/3/variables", "variable")
|
123
|
-
@variable = Gitlab.create_group_variable(3, "NEW_VARIABLE", "new value")
|
124
|
-
end
|
125
|
-
|
126
|
-
it "gets the correct resource" do
|
127
|
-
body = { key: "NEW_VARIABLE", value: "new value" }
|
128
|
-
expect(a_post("/groups/3/variables").with(body: body)).to have_been_made
|
129
|
-
end
|
130
|
-
|
131
|
-
it "returns information about a new variable" do
|
132
|
-
expect(@variable.key).to eq("VARIABLE")
|
133
|
-
expect(@variable.value).to eq("the value")
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
describe ".update_group_variable" do
|
138
|
-
before do
|
139
|
-
stub_put("/groups/3/variables/UPD_VARIABLE", "variable")
|
140
|
-
@variable = Gitlab.update_group_variable(3, "UPD_VARIABLE", "updated value")
|
141
|
-
end
|
142
|
-
|
143
|
-
it "puts the correct resource" do
|
144
|
-
body = { value: "updated value" }
|
145
|
-
expect(a_put("/groups/3/variables/UPD_VARIABLE").with(body: body)).to have_been_made
|
146
|
-
end
|
147
|
-
|
148
|
-
it "returns information about an updated variable" do
|
149
|
-
expect(@variable.key).to eq("VARIABLE")
|
150
|
-
expect(@variable.value).to eq("the value")
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
describe ".remove_group_variable" do
|
155
|
-
before do
|
156
|
-
stub_delete("/groups/3/variables/DEL_VARIABLE", "variable")
|
157
|
-
@variable = Gitlab.remove_group_variable(3, "DEL_VARIABLE")
|
158
|
-
end
|
159
|
-
|
160
|
-
it "gets the correct resource" do
|
161
|
-
expect(a_delete("/groups/3/variables/DEL_VARIABLE")).to have_been_made
|
162
|
-
end
|
163
|
-
|
164
|
-
it "returns information about a deleted variable" do
|
165
|
-
expect(@variable.key).to eq("VARIABLE")
|
166
|
-
expect(@variable.value).to eq("the value")
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
@@ -1,148 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".builds" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/builds", "builds")
|
7
|
-
@builds = Gitlab.builds(3)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/builds")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a paginated response of project's builds" do
|
15
|
-
expect(@builds).to be_a Gitlab::PaginatedResponse
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".build" do
|
20
|
-
before do
|
21
|
-
stub_get("/projects/3/builds/8", "build")
|
22
|
-
@build = Gitlab.build(3, 8)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets the correct resource" do
|
26
|
-
expect(a_get("/projects/3/builds/8")).to have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns a single build" do
|
30
|
-
expect(@build).to be_a Gitlab::ObjectifiedHash
|
31
|
-
end
|
32
|
-
|
33
|
-
it "returns information about a build" do
|
34
|
-
expect(@build.id).to eq(8)
|
35
|
-
expect(@build.user.name).to eq("John Smith")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe ".build_artifacts" do
|
40
|
-
context "when successful request" do
|
41
|
-
before do
|
42
|
-
fixture = load_fixture('build_artifacts')
|
43
|
-
fixture.set_encoding(Encoding::ASCII_8BIT)
|
44
|
-
stub_request(:get, "#{Gitlab.endpoint}/projects/3/builds/8/artifacts").
|
45
|
-
with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
|
46
|
-
to_return(body: fixture.read, headers: { 'Content-Disposition' => "attachment; filename=artifacts.zip" })
|
47
|
-
@build_artifacts = Gitlab.build_artifacts(3, 8)
|
48
|
-
end
|
49
|
-
|
50
|
-
it "gets the correct resource" do
|
51
|
-
expect(a_get("/projects/3/builds/8/artifacts")).to have_been_made
|
52
|
-
end
|
53
|
-
|
54
|
-
it "returns a FileResponse" do
|
55
|
-
expect(@build_artifacts).to be_a Gitlab::FileResponse
|
56
|
-
end
|
57
|
-
|
58
|
-
it "returns a file with filename" do
|
59
|
-
expect(@build_artifacts.filename).to eq "artifacts.zip"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context "when bad request" do
|
64
|
-
it "throws an exception" do
|
65
|
-
stub_get("/projects/3/builds/8/artifacts", "error_project_not_found", 404)
|
66
|
-
expect{ Gitlab.build_artifacts(3, 8) }.to raise_error(Gitlab::Error::NotFound, "Server responded with code 404, message: 404 Project Not Found. Request URI: #{Gitlab.endpoint}/projects/3/builds/8/artifacts")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe ".builds_commits" do
|
72
|
-
before do
|
73
|
-
stub_get("/projects/3/repository/commits/0ff3ae198f8601a285adcf5c0fff204ee6fba5fd/builds", "builds_commits")
|
74
|
-
@builds_commits = Gitlab.commit_builds(3, "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd")
|
75
|
-
end
|
76
|
-
|
77
|
-
it "gets the correct resource" do
|
78
|
-
expect(a_get("/projects/3/repository/commits/0ff3ae198f8601a285adcf5c0fff204ee6fba5fd/builds")).to have_been_made
|
79
|
-
end
|
80
|
-
|
81
|
-
it "returns a paginated response of commit builds" do
|
82
|
-
expect(@builds_commits).to be_a Gitlab::PaginatedResponse
|
83
|
-
end
|
84
|
-
|
85
|
-
it "returns information about the builds" do
|
86
|
-
expect(@builds_commits.count).to eq(2)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
describe ".build_cancel" do
|
93
|
-
before do
|
94
|
-
stub_post("/projects/3/builds/8/cancel", "build_cancel")
|
95
|
-
@build_cancel = Gitlab.build_cancel(3, 8)
|
96
|
-
end
|
97
|
-
|
98
|
-
it "gets the correct resource" do
|
99
|
-
expect(a_post("/projects/3/builds/8/cancel")).to have_been_made
|
100
|
-
end
|
101
|
-
|
102
|
-
it "returns a single build" do
|
103
|
-
expect(@build_cancel).to be_a Gitlab::ObjectifiedHash
|
104
|
-
end
|
105
|
-
|
106
|
-
it "returns information about a build" do
|
107
|
-
expect(@build_cancel.commit.author_name).to eq("John Smith")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe ".build_retry" do
|
112
|
-
before do
|
113
|
-
stub_post("/projects/3/builds/69/retry", "build_retry")
|
114
|
-
@build_retry = Gitlab.build_retry(3, 69)
|
115
|
-
end
|
116
|
-
|
117
|
-
it "gets the correct resource" do
|
118
|
-
expect(a_post("/projects/3/builds/69/retry")).to have_been_made
|
119
|
-
end
|
120
|
-
|
121
|
-
it "returns a single build" do
|
122
|
-
expect(@build_retry).to be_a Gitlab::ObjectifiedHash
|
123
|
-
end
|
124
|
-
|
125
|
-
it "returns information about a build" do
|
126
|
-
expect(@build_retry.commit.author_name).to eq("John Smith")
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe ".build_erase" do
|
131
|
-
before do
|
132
|
-
stub_post("/projects/3/builds/69/erase", "build_erase")
|
133
|
-
@build_retry = Gitlab.build_erase(3, 69)
|
134
|
-
end
|
135
|
-
|
136
|
-
it "gets the correct resource" do
|
137
|
-
expect(a_post("/projects/3/builds/69/erase")).to have_been_made
|
138
|
-
end
|
139
|
-
|
140
|
-
it "returns a single build" do
|
141
|
-
expect(@build_retry).to be_a Gitlab::ObjectifiedHash
|
142
|
-
end
|
143
|
-
|
144
|
-
it "returns information about a build" do
|
145
|
-
expect(@build_retry.commit.author_name).to eq("John Smith")
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|