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,11 +0,0 @@
|
|
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
|
@@ -1,190 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
it { is_expected.to respond_to :repo_commits }
|
5
|
-
it { is_expected.to respond_to :repo_commit }
|
6
|
-
it { is_expected.to respond_to :repo_commit_diff }
|
7
|
-
it { is_expected.to respond_to :repo_commit_comments }
|
8
|
-
it { is_expected.to respond_to :repo_create_commit_comment }
|
9
|
-
it { is_expected.to respond_to :repo_commit_status }
|
10
|
-
it { is_expected.to respond_to :repo_update_commit_status }
|
11
|
-
it { is_expected.to respond_to :repo_commit_merge_requests }
|
12
|
-
|
13
|
-
describe ".commits" do
|
14
|
-
before do
|
15
|
-
stub_get("/projects/3/repository/commits", "project_commits").
|
16
|
-
with(query: { ref_name: "api" })
|
17
|
-
@commits = Gitlab.commits(3, ref_name: "api")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "gets the correct resource" do
|
21
|
-
expect(a_get("/projects/3/repository/commits").
|
22
|
-
with(query: { ref_name: "api" })).to have_been_made
|
23
|
-
end
|
24
|
-
|
25
|
-
it "returns a paginated response of repository commits" do
|
26
|
-
expect(@commits).to be_a Gitlab::PaginatedResponse
|
27
|
-
expect(@commits.first.id).to eq("f7dd067490fe57505f7226c3b54d3127d2f7fd46")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe ".commit" do
|
32
|
-
before do
|
33
|
-
stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6", "project_commit")
|
34
|
-
@commit = Gitlab.commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
|
35
|
-
end
|
36
|
-
|
37
|
-
it "gets the correct resource" do
|
38
|
-
expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6")).
|
39
|
-
to have_been_made
|
40
|
-
end
|
41
|
-
|
42
|
-
it "returns a repository commit" do
|
43
|
-
expect(@commit.id).to eq("6104942438c14ec7bd21c6cd5bd995272b3faff6")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe ".commit_diff" do
|
48
|
-
before do
|
49
|
-
stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff", "project_commit_diff")
|
50
|
-
@diff = Gitlab.commit_diff(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
|
51
|
-
end
|
52
|
-
|
53
|
-
it "gets the correct resource" do
|
54
|
-
expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff")).
|
55
|
-
to have_been_made
|
56
|
-
end
|
57
|
-
|
58
|
-
it "returns a diff of a commit" do
|
59
|
-
expect(@diff.new_path).to eq("doc/update/5.4-to-6.0.md")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe ".commit_comments" do
|
64
|
-
before do
|
65
|
-
stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments", "project_commit_comments")
|
66
|
-
@commit_comments = Gitlab.commit_comments(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
|
67
|
-
end
|
68
|
-
|
69
|
-
it "gets the correct resource" do
|
70
|
-
expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments")).
|
71
|
-
to have_been_made
|
72
|
-
end
|
73
|
-
|
74
|
-
it "returns commit's comments" do
|
75
|
-
expect(@commit_comments).to be_a Gitlab::PaginatedResponse
|
76
|
-
expect(@commit_comments.length).to eq(2)
|
77
|
-
expect(@commit_comments[0].note).to eq("this is the 1st comment on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6")
|
78
|
-
expect(@commit_comments[0].author.id).to eq(11)
|
79
|
-
expect(@commit_comments[1].note).to eq("another discussion point on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6")
|
80
|
-
expect(@commit_comments[1].author.id).to eq(12)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe ".create_commit_comment" do
|
85
|
-
before do
|
86
|
-
stub_post("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments", "project_commit_comment")
|
87
|
-
@merge_request = Gitlab.create_commit_comment(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'Nice code!')
|
88
|
-
end
|
89
|
-
|
90
|
-
it "returns information about the newly created comment" do
|
91
|
-
expect(@merge_request.note).to eq('Nice code!')
|
92
|
-
expect(@merge_request.author.id).to eq(1)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe ".commit_status" do
|
97
|
-
before do
|
98
|
-
stub_get("/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses", 'project_commit_status').
|
99
|
-
with(query: { all: 'true' })
|
100
|
-
@statuses = Gitlab.commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', all: true)
|
101
|
-
end
|
102
|
-
|
103
|
-
it "gets the correct resource" do
|
104
|
-
expect(a_get("/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses").
|
105
|
-
with(query: { all: true }))
|
106
|
-
end
|
107
|
-
|
108
|
-
it "gets statuses of a commit" do
|
109
|
-
expect(@statuses).to be_kind_of Gitlab::PaginatedResponse
|
110
|
-
expect(@statuses.first.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8')
|
111
|
-
expect(@statuses.first.ref).to eq('decreased-spec')
|
112
|
-
expect(@statuses.first.status).to eq('failed')
|
113
|
-
expect(@statuses.last.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8')
|
114
|
-
expect(@statuses.last.status).to eq('success')
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe ".update_commit_status" do
|
119
|
-
before do
|
120
|
-
stub_post("/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8", 'project_update_commit_status').
|
121
|
-
with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' })
|
122
|
-
@status = Gitlab.update_commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', 'failed', name: 'test', ref: 'decreased-spec')
|
123
|
-
end
|
124
|
-
|
125
|
-
it "gets the correct resource" do
|
126
|
-
expect(a_post('/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8').
|
127
|
-
with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' }))
|
128
|
-
end
|
129
|
-
|
130
|
-
it "returns information about the newly created status" do
|
131
|
-
expect(@status).to be_kind_of Gitlab::ObjectifiedHash
|
132
|
-
expect(@status.id).to eq(498)
|
133
|
-
expect(@status.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8')
|
134
|
-
expect(@status.status).to eq('failed')
|
135
|
-
expect(@status.ref).to eq('decreased-spec')
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe ".create_commit" do
|
140
|
-
let(:actions) do
|
141
|
-
[
|
142
|
-
{
|
143
|
-
action: "create",
|
144
|
-
file_path: "foo/bar",
|
145
|
-
content: "some content"
|
146
|
-
}
|
147
|
-
]
|
148
|
-
end
|
149
|
-
|
150
|
-
let(:query) do
|
151
|
-
{
|
152
|
-
branch: 'dev',
|
153
|
-
commit_message: 'refactors everything',
|
154
|
-
actions: actions,
|
155
|
-
author_email: 'joe@sample.org',
|
156
|
-
author_name: 'Joe Sample'
|
157
|
-
}
|
158
|
-
end
|
159
|
-
|
160
|
-
before do
|
161
|
-
stub_post("/projects/6/repository/commits", 'project_commit_create').with(body: query)
|
162
|
-
@commit = Gitlab.create_commit(6, 'dev', 'refactors everything', actions, {author_email: 'joe@sample.org', author_name: 'Joe Sample'})
|
163
|
-
end
|
164
|
-
|
165
|
-
it "returns id of a created commit" do
|
166
|
-
expect(@commit.id).to eq('ed899a2f4b50b4370feeea94676502b42383c746')
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
describe ".repo_commit_merge_requests" do
|
171
|
-
before do
|
172
|
-
stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/merge_requests", "project_commit_merge_requests")
|
173
|
-
@commit_merge_requests = Gitlab.commit_merge_requests(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
|
174
|
-
end
|
175
|
-
|
176
|
-
it "gets the correct resource" do
|
177
|
-
expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/merge_requests")).
|
178
|
-
to have_been_made
|
179
|
-
end
|
180
|
-
|
181
|
-
it "returns commit's associated merge_requests" do
|
182
|
-
expect(@commit_merge_requests).to be_a Gitlab::PaginatedResponse
|
183
|
-
expect(@commit_merge_requests.length).to eq(2)
|
184
|
-
expect(@commit_merge_requests[0].iid).to eq(1)
|
185
|
-
expect(@commit_merge_requests[0].author.id).to eq(1)
|
186
|
-
expect(@commit_merge_requests[1].iid).to eq(2)
|
187
|
-
expect(@commit_merge_requests[1].author.id).to eq(2)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".deployments" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/deployments", "deployments")
|
7
|
-
@deployments = Gitlab.deployments(3)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/deployments")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a paginated response of project's deployments" do
|
15
|
-
expect(@deployments).to be_a Gitlab::PaginatedResponse
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".deployment" do
|
20
|
-
before do
|
21
|
-
stub_get("/projects/3/deployments/42", "deployment")
|
22
|
-
@deployment = Gitlab.deployment(3, 42)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets the correct resource" do
|
26
|
-
expect(a_get("/projects/3/deployments/42")).to have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns a single deployment" do
|
30
|
-
expect(@deployment).to be_a Gitlab::ObjectifiedHash
|
31
|
-
end
|
32
|
-
|
33
|
-
it "returns information about an deployment" do
|
34
|
-
expect(@deployment.id).to eq(42)
|
35
|
-
expect(@deployment.deployable.commit.id).to eq("a91957a858320c0e17f3a0eca7cfacbff50ea29a")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,132 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".environments" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/environments", "environments")
|
7
|
-
@environments = Gitlab.environments(3)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/environments")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a paginated response of project's environments" do
|
15
|
-
expect(@environments).to be_a Gitlab::PaginatedResponse
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".environment" do
|
20
|
-
before do
|
21
|
-
stub_get("/projects/3/environments/12", "environment")
|
22
|
-
@environment = Gitlab.environment(3, 12)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets the correct resource" do
|
26
|
-
expect(a_get("/projects/3/environments/12")).to have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns a single environment" do
|
30
|
-
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
31
|
-
end
|
32
|
-
|
33
|
-
it "returns information about an environment" do
|
34
|
-
expect(@environment.id).to eq(12)
|
35
|
-
expect(@environment.name).to eq("staging")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe ".create_environment" do
|
40
|
-
context "without external_url" do
|
41
|
-
before do
|
42
|
-
stub_post("/projects/3/environments", "environment")
|
43
|
-
@environment = Gitlab.create_environment(3, 'staging')
|
44
|
-
end
|
45
|
-
|
46
|
-
it "gets the correct resource" do
|
47
|
-
expect(a_post("/projects/3/environments").with(body: { name: 'staging' })).to have_been_made
|
48
|
-
end
|
49
|
-
|
50
|
-
it "returns a single environment" do
|
51
|
-
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
52
|
-
end
|
53
|
-
|
54
|
-
it "returns information about an environment" do
|
55
|
-
expect(@environment.name).to eq("staging")
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context "with external_url" do
|
60
|
-
before do
|
61
|
-
stub_post("/projects/3/environments", "environment")
|
62
|
-
@environment = Gitlab.create_environment(3, 'staging', external_url: "https://staging.example.gitlab.com")
|
63
|
-
end
|
64
|
-
|
65
|
-
it "gets the correct resource" do
|
66
|
-
expect(a_post("/projects/3/environments")
|
67
|
-
.with(body: { name: 'staging', external_url: "https://staging.example.gitlab.com" })).to have_been_made
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe ".edit_environment" do
|
73
|
-
before do
|
74
|
-
stub_put("/projects/3/environments/12", "environment")
|
75
|
-
@environment = Gitlab.edit_environment(3, 12, {
|
76
|
-
name: 'staging',
|
77
|
-
external_url: "https://staging.example.gitlab.com"
|
78
|
-
})
|
79
|
-
end
|
80
|
-
|
81
|
-
it "gets the correct resource" do
|
82
|
-
expect(a_put("/projects/3/environments/12")
|
83
|
-
.with(body: { name: 'staging', external_url: "https://staging.example.gitlab.com" })).to have_been_made
|
84
|
-
end
|
85
|
-
|
86
|
-
it "returns a single environment" do
|
87
|
-
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
88
|
-
end
|
89
|
-
|
90
|
-
it "returns information about an environment" do
|
91
|
-
expect(@environment.name).to eq("staging")
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe ".delete_environment" do
|
96
|
-
before do
|
97
|
-
stub_delete("/projects/3/environments/12", "environment")
|
98
|
-
@environment = Gitlab.delete_environment(3, 12)
|
99
|
-
end
|
100
|
-
|
101
|
-
it "gets the correct resource" do
|
102
|
-
expect(a_delete("/projects/3/environments/12")).to have_been_made
|
103
|
-
end
|
104
|
-
|
105
|
-
it "returns a single pipeline" do
|
106
|
-
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
107
|
-
end
|
108
|
-
|
109
|
-
it "returns information about a pipeline" do
|
110
|
-
expect(@environment.name).to eq("staging")
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe ".stop_environment" do
|
115
|
-
before do
|
116
|
-
stub_post("/projects/3/environments/12/stop", "environment")
|
117
|
-
@environment = Gitlab.stop_environment(3, 12)
|
118
|
-
end
|
119
|
-
|
120
|
-
it "gets the correct resource" do
|
121
|
-
expect(a_post("/projects/3/environments/12/stop")).to have_been_made
|
122
|
-
end
|
123
|
-
|
124
|
-
it "returns a single pipeline" do
|
125
|
-
expect(@environment).to be_a Gitlab::ObjectifiedHash
|
126
|
-
end
|
127
|
-
|
128
|
-
it "returns information about a pipeline" do
|
129
|
-
expect(@environment.name).to eq("staging")
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".events" do
|
5
|
-
before do
|
6
|
-
stub_get("/events", "user_events")
|
7
|
-
@events = Gitlab.events()
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/events")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "it returns a response of user's events" do
|
15
|
-
expect(@events).to be_a Gitlab::PaginatedResponse
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".user_events" do
|
20
|
-
before do
|
21
|
-
stub_get("/users/1/events", "user_events")
|
22
|
-
@events = Gitlab.user_events(1)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets the correct resource" do
|
26
|
-
expect(a_get("/users/1/events")).to have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns a response of user's contribution events" do
|
30
|
-
expect(@events).to be_a Gitlab::PaginatedResponse
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '.project_events' do
|
35
|
-
before do
|
36
|
-
stub_get("/1/events", "project_events")
|
37
|
-
@events = Gitlab.project_events(1)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "gets the correct resource" do
|
41
|
-
expect(a_get("/1/events")).to have_been_made
|
42
|
-
end
|
43
|
-
|
44
|
-
it "returns a response of project's visible events" do
|
45
|
-
expect(@events).to be_a Gitlab::PaginatedResponse
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".group_milestones" do
|
5
|
-
before do
|
6
|
-
stub_get("/groups/3/milestones", "group_milestones")
|
7
|
-
@milestones = Gitlab.group_milestones(3)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/groups/3/milestones")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a paginated response of group's milestones" do
|
15
|
-
expect(@milestones).to be_a Gitlab::PaginatedResponse
|
16
|
-
expect(@milestones.first.group_id).to eq(3)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe ".group_milestone" do
|
21
|
-
before do
|
22
|
-
stub_get("/groups/3/milestones/1", "group_milestone")
|
23
|
-
@milestone = Gitlab.group_milestone(3, 1)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "gets the correct resource" do
|
27
|
-
expect(a_get("/groups/3/milestones/1")).to have_been_made
|
28
|
-
end
|
29
|
-
|
30
|
-
it "returns information about a milestone" do
|
31
|
-
expect(@milestone.group_id).to eq(3)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe ".create_group_milestone" do
|
36
|
-
before do
|
37
|
-
stub_post("/groups/3/milestones", "group_milestone")
|
38
|
-
@milestone = Gitlab.create_group_milestone(3, 'title')
|
39
|
-
end
|
40
|
-
|
41
|
-
it "gets the correct resource" do
|
42
|
-
expect(a_post("/groups/3/milestones").
|
43
|
-
with(body: { title: 'title' })).to have_been_made
|
44
|
-
end
|
45
|
-
|
46
|
-
it "returns information about a created milestone" do
|
47
|
-
expect(@milestone.group_id).to eq(3)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe ".edit_group_milestone" do
|
52
|
-
before do
|
53
|
-
stub_put("/groups/3/milestones/33", "group_milestone")
|
54
|
-
@milestone = Gitlab.edit_group_milestone(3, 33, title: 'title')
|
55
|
-
end
|
56
|
-
|
57
|
-
it "gets the correct resource" do
|
58
|
-
expect(a_put("/groups/3/milestones/33").
|
59
|
-
with(body: { title: 'title' })).to have_been_made
|
60
|
-
end
|
61
|
-
|
62
|
-
it "returns information about an edited milestone" do
|
63
|
-
expect(@milestone.group_id).to eq(3)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe ".group_milestone_issues" do
|
68
|
-
before do
|
69
|
-
stub_get("/groups/3/milestones/1/issues", "group_milestone_issues")
|
70
|
-
@milestone_issues = Gitlab.group_milestone_issues(3, 1)
|
71
|
-
end
|
72
|
-
|
73
|
-
it "gets the correct resource" do
|
74
|
-
expect(a_get("/groups/3/milestones/1/issues")).to have_been_made
|
75
|
-
end
|
76
|
-
|
77
|
-
it "returns a paginated response of milestone's issues" do
|
78
|
-
expect(@milestone_issues).to be_a Gitlab::PaginatedResponse
|
79
|
-
expect(@milestone_issues.first.milestone.id).to eq(1)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe ".group_milestone_merge_requests" do
|
84
|
-
before do
|
85
|
-
stub_get("/groups/3/milestones/1/merge_requests", "group_milestone_merge_requests")
|
86
|
-
@milestone_merge_requests = Gitlab.group_milestone_merge_requests(3, 1)
|
87
|
-
end
|
88
|
-
|
89
|
-
it "gets the correct resource" do
|
90
|
-
expect(a_get("/groups/3/milestones/1/merge_requests")).to have_been_made
|
91
|
-
end
|
92
|
-
|
93
|
-
it "returns a paginated response of milestone's merge_requests" do
|
94
|
-
expect(@milestone_merge_requests).to be_a Gitlab::PaginatedResponse
|
95
|
-
expect(@milestone_merge_requests.first.milestone.id).to eq(1)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|