gitlab 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +33 -0
- data/.travis.yml +8 -3
- data/README.md +7 -7
- data/Rakefile +11 -3
- data/gitlab.gemspec +11 -11
- data/lib/gitlab.rb +2 -2
- data/lib/gitlab/api.rb +2 -1
- data/lib/gitlab/cli.rb +2 -6
- data/lib/gitlab/cli_helpers.rb +18 -20
- data/lib/gitlab/client.rb +8 -5
- data/lib/gitlab/client/branches.rb +4 -4
- data/lib/gitlab/client/build_variables.rb +64 -2
- data/lib/gitlab/client/deployments.rb +32 -0
- data/lib/gitlab/client/groups.rb +49 -0
- data/lib/gitlab/client/issues.rb +71 -0
- data/lib/gitlab/client/merge_requests.rb +1 -0
- data/lib/gitlab/client/pipeline_schedules.rb +133 -0
- data/lib/gitlab/client/pipeline_triggers.rb +2 -2
- data/lib/gitlab/client/projects.rb +1 -1
- data/lib/gitlab/client/repository_files.rb +2 -2
- data/lib/gitlab/client/users.rb +5 -5
- data/lib/gitlab/configuration.rb +2 -2
- data/lib/gitlab/error.rb +10 -2
- data/lib/gitlab/file_response.rb +1 -1
- data/lib/gitlab/help.rb +5 -6
- data/lib/gitlab/page_links.rb +2 -2
- data/lib/gitlab/request.rb +34 -50
- data/lib/gitlab/shell.rb +5 -8
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/deployment.json +57 -0
- data/spec/fixtures/deployments.json +116 -0
- data/spec/fixtures/group_edit.json +14 -0
- data/spec/fixtures/group_subgroups.json +16 -0
- data/spec/fixtures/pipeline_schedule.json +32 -0
- data/spec/fixtures/pipeline_schedule_create.json +21 -0
- data/spec/fixtures/pipeline_schedule_update.json +26 -0
- data/spec/fixtures/pipeline_schedule_variable.json +5 -0
- data/spec/fixtures/pipeline_schedule_variable_update.json +5 -0
- data/spec/fixtures/pipeline_schedules.json +22 -0
- data/spec/gitlab/api_spec.rb +11 -0
- data/spec/gitlab/cli_helpers_spec.rb +14 -15
- data/spec/gitlab/cli_spec.rb +11 -11
- data/spec/gitlab/client/award_emojis_spec.rb +55 -55
- data/spec/gitlab/client/boards_spec.rb +12 -12
- data/spec/gitlab/client/branches_spec.rb +22 -22
- data/spec/gitlab/client/build_variables_spec.rb +93 -10
- data/spec/gitlab/client/builds_spec.rb +36 -36
- data/spec/gitlab/client/commits_spec.rb +21 -21
- data/spec/gitlab/client/deployments_spec.rb +38 -0
- data/spec/gitlab/client/environments_spec.rb +18 -18
- data/spec/gitlab/client/groups_spec.rb +73 -22
- data/spec/gitlab/client/issues_spec.rb +121 -22
- data/spec/gitlab/client/jobs_spec.rb +13 -13
- data/spec/gitlab/client/keys_spec.rb +2 -2
- data/spec/gitlab/client/labels_spec.rb +12 -12
- data/spec/gitlab/client/merge_requests_spec.rb +23 -23
- data/spec/gitlab/client/milestones_spec.rb +12 -12
- data/spec/gitlab/client/namespaces_spec.rb +3 -3
- data/spec/gitlab/client/notes_spec.rb +40 -40
- data/spec/gitlab/client/pipeline_schedules_spec.rb +158 -0
- data/spec/gitlab/client/pipeline_triggers_spec.rb +17 -17
- data/spec/gitlab/client/pipelines_spec.rb +22 -22
- data/spec/gitlab/client/projects_spec.rb +75 -75
- data/spec/gitlab/client/repositories_spec.rb +16 -16
- data/spec/gitlab/client/repository_files_spec.rb +10 -10
- data/spec/gitlab/client/runners_spec.rb +20 -22
- data/spec/gitlab/client/services_spec.rb +6 -6
- data/spec/gitlab/client/snippets_spec.rb +12 -12
- data/spec/gitlab/client/system_hooks_spec.rb +12 -12
- data/spec/gitlab/client/tags_spec.rb +19 -20
- data/spec/gitlab/client/todos_spec.rb +12 -12
- data/spec/gitlab/client/users_spec.rb +49 -49
- data/spec/gitlab/error_spec.rb +50 -23
- data/spec/gitlab/file_response_spec.rb +6 -6
- data/spec/gitlab/help_spec.rb +5 -5
- data/spec/gitlab/objectified_hash_spec.rb +8 -8
- data/spec/gitlab/page_links_spec.rb +1 -1
- data/spec/gitlab/paginated_response_spec.rb +4 -4
- data/spec/gitlab/request_spec.rb +19 -19
- data/spec/gitlab/shell_spec.rb +12 -12
- data/spec/gitlab_spec.rb +13 -14
- data/spec/spec_helper.rb +10 -45
- metadata +46 -3
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Gitlab::Client do
|
4
|
-
it {
|
5
|
-
it {
|
6
|
-
it {
|
7
|
-
it {
|
8
|
-
it {
|
9
|
-
it {
|
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
10
|
|
11
11
|
describe ".tags" do
|
12
12
|
before do
|
@@ -14,11 +14,11 @@ describe Gitlab::Client do
|
|
14
14
|
@tags = Gitlab.tags(3)
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "gets the correct resource" do
|
18
18
|
expect(a_get("/projects/3/repository/tags")).to have_been_made
|
19
19
|
end
|
20
20
|
|
21
|
-
it "
|
21
|
+
it "returns a paginated response of repository tags" do
|
22
22
|
expect(@tags).to be_a Gitlab::PaginatedResponse
|
23
23
|
expect(@tags.first.name).to eq("v2.8.2")
|
24
24
|
end
|
@@ -31,11 +31,11 @@ describe Gitlab::Client do
|
|
31
31
|
@tag = Gitlab.create_tag(3, 'v1.0.0', '2695effb5807a22ff3d138d593fd856244e155e7')
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "gets the correct resource" do
|
35
35
|
expect(a_post("/projects/3/repository/tags")).to have_been_made
|
36
36
|
end
|
37
37
|
|
38
|
-
it "
|
38
|
+
it "returns information about a new repository tag" do
|
39
39
|
expect(@tag.name).to eq("v1.0.0")
|
40
40
|
expect(@tag.message).to eq(nil)
|
41
41
|
end
|
@@ -47,11 +47,11 @@ describe Gitlab::Client do
|
|
47
47
|
@tag = Gitlab.create_tag(3, 'v1.1.0', '2695effb5807a22ff3d138d593fd856244e155e7', 'Release 1.1.0')
|
48
48
|
end
|
49
49
|
|
50
|
-
it "
|
50
|
+
it "gets the correct resource" do
|
51
51
|
expect(a_post("/projects/3/repository/tags")).to have_been_made
|
52
52
|
end
|
53
53
|
|
54
|
-
it "
|
54
|
+
it "returns information about a new repository tag" do
|
55
55
|
expect(@tag.name).to eq("v1.1.0")
|
56
56
|
expect(@tag.message).to eq("Release 1.1.0")
|
57
57
|
end
|
@@ -64,11 +64,11 @@ describe Gitlab::Client do
|
|
64
64
|
@tree = Gitlab.tree(3)
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
67
|
+
it "gets the correct resource" do
|
68
68
|
expect(a_get("/projects/3/repository/tree")).to have_been_made
|
69
69
|
end
|
70
70
|
|
71
|
-
it "
|
71
|
+
it "returns a paginated response of repository tree files (root level)" do
|
72
72
|
expect(@tree).to be_a Gitlab::PaginatedResponse
|
73
73
|
expect(@tree.first.name).to eq("app")
|
74
74
|
end
|
@@ -81,12 +81,12 @@ describe Gitlab::Client do
|
|
81
81
|
@diff = Gitlab.compare(3, 'master', 'feature')
|
82
82
|
end
|
83
83
|
|
84
|
-
it "
|
84
|
+
it "gets the correct resource" do
|
85
85
|
expect(a_get("/projects/3/repository/compare").
|
86
86
|
with(query: { from: "master", to: "feature" })).to have_been_made
|
87
87
|
end
|
88
88
|
|
89
|
-
it "
|
89
|
+
it "gets diffs of a merge request" do
|
90
90
|
expect(@diff.diffs).to be_kind_of Array
|
91
91
|
expect(@diff.diffs.last["new_path"]).to eq "files/js/application.js"
|
92
92
|
end
|
@@ -7,11 +7,11 @@ describe Gitlab::Client do
|
|
7
7
|
@file_contents = Gitlab.file_contents(3, "Gemfile")
|
8
8
|
end
|
9
9
|
|
10
|
-
it "
|
10
|
+
it "gets the correct resource" do
|
11
11
|
expect(a_get("/projects/3/repository/files/Gemfile/raw?ref=master")).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
-
it "
|
14
|
+
it "returns file contents" do
|
15
15
|
expect(@file_contents).to eq("source 'https://rubygems.org'\ngem 'rails', '4.1.2'\n")
|
16
16
|
end
|
17
17
|
end
|
@@ -22,11 +22,11 @@ describe Gitlab::Client do
|
|
22
22
|
@file = Gitlab.get_file(3, 'README.md', 'master')
|
23
23
|
end
|
24
24
|
|
25
|
-
it "
|
25
|
+
it "gets the correct resource" do
|
26
26
|
expect(a_get("/projects/3/repository/files/README%2Emd?ref=master")).to have_been_made
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "returns the base64 encoded file" do
|
30
30
|
expect(@file.file_path).to eq "README.md"
|
31
31
|
expect(@file.ref).to eq "master"
|
32
32
|
expect(@file.content).to eq "VGhpcyBpcyBhICpSRUFETUUqIQ==\n"
|
@@ -38,7 +38,7 @@ describe Gitlab::Client do
|
|
38
38
|
let!(:request_stub) { stub_post(api_path, "repository_file") }
|
39
39
|
let!(:file) { Gitlab.create_file(3, "path", "branch", "content", "commit message", author_name: "joe") }
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "creates the correct resource" do
|
42
42
|
expected_parameters = {
|
43
43
|
author_name: "joe",
|
44
44
|
branch: "branch",
|
@@ -47,7 +47,7 @@ describe Gitlab::Client do
|
|
47
47
|
expect(a_post(api_path).with(body: hash_including(expected_parameters))).to have_been_made
|
48
48
|
end
|
49
49
|
|
50
|
-
it "
|
50
|
+
it "returns information about the new file" do
|
51
51
|
expect(file.file_path).to eq "path"
|
52
52
|
expect(file.branch_name).to eq "branch"
|
53
53
|
end
|
@@ -58,7 +58,7 @@ describe Gitlab::Client do
|
|
58
58
|
let!(:request_stub) { stub_put(api_path, "repository_file") }
|
59
59
|
let!(:file) { Gitlab.edit_file(3, "path", "branch", "content", "commit message", author_name: "joe") }
|
60
60
|
|
61
|
-
it "
|
61
|
+
it "updates the correct resource" do
|
62
62
|
expected_parameters = {
|
63
63
|
author_name: "joe",
|
64
64
|
branch: "branch",
|
@@ -67,7 +67,7 @@ describe Gitlab::Client do
|
|
67
67
|
expect(a_put(api_path).with(body: hash_including(expected_parameters))).to have_been_made
|
68
68
|
end
|
69
69
|
|
70
|
-
it "
|
70
|
+
it "returns information about the new file" do
|
71
71
|
expect(file.file_path).to eq "path"
|
72
72
|
expect(file.branch_name).to eq "branch"
|
73
73
|
end
|
@@ -78,7 +78,7 @@ describe Gitlab::Client do
|
|
78
78
|
let!(:request_stub) { stub_delete(api_path, "repository_file") }
|
79
79
|
let!(:file) { Gitlab.remove_file(3, "path", "branch", "commit message", author_name: "joe") }
|
80
80
|
|
81
|
-
it "
|
81
|
+
it "updates the correct resource" do
|
82
82
|
expected_parameters = {
|
83
83
|
author_name: "joe",
|
84
84
|
branch: "branch",
|
@@ -87,7 +87,7 @@ describe Gitlab::Client do
|
|
87
87
|
expect(a_delete(api_path).with(body: hash_including(expected_parameters))).to have_been_made
|
88
88
|
end
|
89
89
|
|
90
|
-
it "
|
90
|
+
it "returns information about the new file" do
|
91
91
|
expect(file.file_path).to eq "path"
|
92
92
|
expect(file.branch_name).to eq "branch"
|
93
93
|
end
|
@@ -12,11 +12,11 @@ describe Gitlab::Client do
|
|
12
12
|
@runner = Gitlab.runners
|
13
13
|
end
|
14
14
|
|
15
|
-
it "
|
15
|
+
it "gets the correct resource" do
|
16
16
|
expect(a_get("/runners")).to have_been_made
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "returns a paginated response of runners" do
|
20
20
|
expect(@runner).to be_a Gitlab::PaginatedResponse
|
21
21
|
expect(@runner.first.id).to eq(6)
|
22
22
|
expect(@runner.first.description).to eq('test-1-20150125')
|
@@ -29,11 +29,11 @@ describe Gitlab::Client do
|
|
29
29
|
@runner = Gitlab.runners({scope: :online})
|
30
30
|
end
|
31
31
|
|
32
|
-
it "
|
32
|
+
it "gets the correct resource" do
|
33
33
|
expect(a_get("/runners").with(query: { scope: :online })).to have_been_made
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "returns a paginated response of runners" do
|
37
37
|
expect(@runner).to be_a Gitlab::PaginatedResponse
|
38
38
|
expect(@runner.first.id).to eq(6)
|
39
39
|
expect(@runner.first.description).to eq('test-1-20150125')
|
@@ -52,11 +52,11 @@ describe Gitlab::Client do
|
|
52
52
|
@runner = Gitlab.all_runners
|
53
53
|
end
|
54
54
|
|
55
|
-
it "
|
55
|
+
it "gets the correct resource" do
|
56
56
|
expect(a_get("/runners/all")).to have_been_made
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "returns a paginated response of runners" do
|
60
60
|
expect(@runner).to be_a Gitlab::PaginatedResponse
|
61
61
|
expect(@runner.first.id).to eq(6)
|
62
62
|
expect(@runner.first.description).to eq('test-1-20150125')
|
@@ -69,11 +69,11 @@ describe Gitlab::Client do
|
|
69
69
|
@runner = Gitlab.all_runners({scope: :online})
|
70
70
|
end
|
71
71
|
|
72
|
-
it "
|
72
|
+
it "gets the correct resource" do
|
73
73
|
expect(a_get("/runners/all").with(query: { scope: :online })).to have_been_made
|
74
74
|
end
|
75
75
|
|
76
|
-
it "
|
76
|
+
it "returns a paginated response of runners" do
|
77
77
|
expect(@runner).to be_a Gitlab::PaginatedResponse
|
78
78
|
expect(@runner.first.id).to eq(6)
|
79
79
|
expect(@runner.first.description).to eq('test-1-20150125')
|
@@ -87,11 +87,11 @@ describe Gitlab::Client do
|
|
87
87
|
@runners = Gitlab.runner(6)
|
88
88
|
end
|
89
89
|
|
90
|
-
it "
|
90
|
+
it "gets the correct resource" do
|
91
91
|
expect(a_get("/runners/6")).to have_been_made
|
92
92
|
end
|
93
93
|
|
94
|
-
it "
|
94
|
+
it "returns a response of a runner" do
|
95
95
|
expect(@runners).to be_a Gitlab::ObjectifiedHash
|
96
96
|
expect(@runners.id).to eq(6)
|
97
97
|
expect(@runners.description).to eq('test-1-20150125')
|
@@ -104,11 +104,11 @@ describe Gitlab::Client do
|
|
104
104
|
@runner = Gitlab.update_runner(6, description: "abcefg" )
|
105
105
|
end
|
106
106
|
|
107
|
-
it "
|
107
|
+
it "gets the correct resource" do
|
108
108
|
expect(a_put("/runners/6").with(query: { description: "abcefg" })).to have_been_made
|
109
109
|
end
|
110
110
|
|
111
|
-
it "
|
111
|
+
it "returns an updated response of a runner" do
|
112
112
|
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
113
113
|
expect(@runner.description).to eq('abcefg')
|
114
114
|
end
|
@@ -120,11 +120,11 @@ describe Gitlab::Client do
|
|
120
120
|
@runner = Gitlab.delete_runner(6)
|
121
121
|
end
|
122
122
|
|
123
|
-
it "
|
123
|
+
it "gets the correct resource" do
|
124
124
|
expect(a_delete("/runners/6")).to have_been_made
|
125
125
|
end
|
126
126
|
|
127
|
-
it "
|
127
|
+
it "returns a response of the deleted runner" do
|
128
128
|
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
129
129
|
expect(@runner.id).to eq(6)
|
130
130
|
end
|
@@ -136,11 +136,11 @@ describe Gitlab::Client do
|
|
136
136
|
@runners = Gitlab.project_runners(1)
|
137
137
|
end
|
138
138
|
|
139
|
-
it "
|
139
|
+
it "gets the correct resource" do
|
140
140
|
expect(a_get("/projects/1/runners")).to have_been_made
|
141
141
|
end
|
142
142
|
|
143
|
-
it "
|
143
|
+
it "returns a paginated response of runners" do
|
144
144
|
expect(@runners).to be_a Gitlab::PaginatedResponse
|
145
145
|
expect(@runners.first.id).to eq(8)
|
146
146
|
expect(@runners.first.description).to eq('test-2-20150125')
|
@@ -153,11 +153,11 @@ describe Gitlab::Client do
|
|
153
153
|
@runner = Gitlab.project_enable_runner(1, 6)
|
154
154
|
end
|
155
155
|
|
156
|
-
it "
|
156
|
+
it "gets the correct resource" do
|
157
157
|
expect(a_post("/projects/1/runners")).to have_been_made
|
158
158
|
end
|
159
159
|
|
160
|
-
it "
|
160
|
+
it "returns a response of the enabled runner" do
|
161
161
|
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
162
162
|
expect(@runner.id).to eq(6)
|
163
163
|
expect(@runner.description).to eq('test-1-20150125')
|
@@ -170,16 +170,14 @@ describe Gitlab::Client do
|
|
170
170
|
@runner = Gitlab.project_disable_runner(1, 6)
|
171
171
|
end
|
172
172
|
|
173
|
-
it "
|
173
|
+
it "gets the correct resource" do
|
174
174
|
expect(a_delete("/projects/1/runners/6")).to have_been_made
|
175
175
|
end
|
176
176
|
|
177
|
-
it "
|
177
|
+
it "returns a response of the disabled runner" do
|
178
178
|
expect(@runner).to be_a Gitlab::ObjectifiedHash
|
179
179
|
expect(@runner.id).to eq(6)
|
180
180
|
expect(@runner.description).to eq('test-1-20150125')
|
181
181
|
end
|
182
182
|
end
|
183
|
-
|
184
|
-
|
185
183
|
end
|
@@ -7,11 +7,11 @@ describe Gitlab::Client do
|
|
7
7
|
@service = Gitlab.service(3, :redmine)
|
8
8
|
end
|
9
9
|
|
10
|
-
it "
|
10
|
+
it "gets the correct resource" do
|
11
11
|
expect(a_get("/projects/3/services/redmine")).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
-
it "
|
14
|
+
it "returns a information about a service of project" do
|
15
15
|
expect(@service.id).to eq 38
|
16
16
|
expect(@service.title).to eq("Redmine")
|
17
17
|
expect(@service.properties.project_url).to eq("https://example.com/projects/test_project/issue")
|
@@ -26,14 +26,14 @@ describe Gitlab::Client do
|
|
26
26
|
issues_url: 'https://example.com/issues/:id')
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "gets the correct resource" do
|
30
30
|
body = {new_issue_url: 'https://example.com/projects/test_project/issues/new',
|
31
31
|
project_url: 'https://example.com/projects/test_project/issues',
|
32
32
|
issues_url: 'https://example.com/issues/:id'}
|
33
33
|
expect(a_put("/projects/3/services/redmine").with(body: body)).to have_been_made
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "returns information about a new service" do
|
37
37
|
expect(@service).to be_truthy
|
38
38
|
end
|
39
39
|
end
|
@@ -44,11 +44,11 @@ describe Gitlab::Client do
|
|
44
44
|
@service = Gitlab.delete_service(3, :redmine)
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
47
|
+
it "gets the correct resource" do
|
48
48
|
expect(a_delete("/projects/3/services/redmine")).to have_been_made
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
51
|
+
it "returns information about a deleted service" do
|
52
52
|
expect(@service).to be_truthy
|
53
53
|
end
|
54
54
|
end
|
@@ -7,11 +7,11 @@ describe Gitlab::Client do
|
|
7
7
|
@snippets = Gitlab.snippets(3)
|
8
8
|
end
|
9
9
|
|
10
|
-
it "
|
10
|
+
it "gets the correct resource" do
|
11
11
|
expect(a_get("/projects/3/snippets")).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
-
it "
|
14
|
+
it "returns a paginated response of project's snippets" do
|
15
15
|
expect(@snippets).to be_a Gitlab::PaginatedResponse
|
16
16
|
expect(@snippets.first.file_name).to eq("mailer_test.rb")
|
17
17
|
end
|
@@ -23,11 +23,11 @@ describe Gitlab::Client do
|
|
23
23
|
@snippet = Gitlab.snippet(3, 1)
|
24
24
|
end
|
25
25
|
|
26
|
-
it "
|
26
|
+
it "gets the correct resource" do
|
27
27
|
expect(a_get("/projects/3/snippets/1")).to have_been_made
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "returns information about a snippet" do
|
31
31
|
expect(@snippet.file_name).to eq("mailer_test.rb")
|
32
32
|
expect(@snippet.author.name).to eq("John Smith")
|
33
33
|
end
|
@@ -39,12 +39,12 @@ describe Gitlab::Client do
|
|
39
39
|
@snippet = Gitlab.create_snippet(3, title: 'API', file_name: 'api.rb', code: 'code')
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
42
|
+
it "gets the correct resource" do
|
43
43
|
body = { title: 'API', file_name: 'api.rb', code: 'code' }
|
44
44
|
expect(a_post("/projects/3/snippets").with(body: body)).to have_been_made
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
47
|
+
it "returns information about a new snippet" do
|
48
48
|
expect(@snippet.file_name).to eq("mailer_test.rb")
|
49
49
|
expect(@snippet.author.name).to eq("John Smith")
|
50
50
|
end
|
@@ -56,12 +56,12 @@ describe Gitlab::Client do
|
|
56
56
|
@snippet = Gitlab.edit_snippet(3, 1, file_name: 'mailer_test.rb')
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "gets the correct resource" do
|
60
60
|
expect(a_put("/projects/3/snippets/1").
|
61
61
|
with(body: { file_name: 'mailer_test.rb' })).to have_been_made
|
62
62
|
end
|
63
63
|
|
64
|
-
it "
|
64
|
+
it "returns information about an edited snippet" do
|
65
65
|
expect(@snippet.file_name).to eq("mailer_test.rb")
|
66
66
|
expect(@snippet.author.name).to eq("John Smith")
|
67
67
|
end
|
@@ -73,11 +73,11 @@ describe Gitlab::Client do
|
|
73
73
|
@snippet = Gitlab.delete_snippet(3, 1)
|
74
74
|
end
|
75
75
|
|
76
|
-
it "
|
76
|
+
it "gets the correct resource" do
|
77
77
|
expect(a_delete("/projects/3/snippets/1")).to have_been_made
|
78
78
|
end
|
79
79
|
|
80
|
-
it "
|
80
|
+
it "returns information about a deleted snippet" do
|
81
81
|
expect(@snippet.file_name).to eq("mailer_test.rb")
|
82
82
|
expect(@snippet.author.name).to eq("John Smith")
|
83
83
|
end
|
@@ -89,11 +89,11 @@ describe Gitlab::Client do
|
|
89
89
|
@snippet_content = Gitlab.snippet_content(3, 1)
|
90
90
|
end
|
91
91
|
|
92
|
-
it "
|
92
|
+
it "gets the correct resource" do
|
93
93
|
expect(a_get("/projects/3/snippets/1/raw")).to have_been_made
|
94
94
|
end
|
95
95
|
|
96
|
-
it "
|
96
|
+
it "returns raw content of a snippet" do
|
97
97
|
expect(@snippet_content).to eq("#!/usr/bin/env ruby\n\nputs \"Cool snippet!\"\n")
|
98
98
|
end
|
99
99
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Gitlab::Client do
|
4
|
-
it {
|
5
|
-
it {
|
6
|
-
it {
|
7
|
-
it {
|
4
|
+
it { is_expected.to respond_to :system_hooks }
|
5
|
+
it { is_expected.to respond_to :add_system_hook }
|
6
|
+
it { is_expected.to respond_to :system_hook }
|
7
|
+
it { is_expected.to respond_to :delete_system_hook }
|
8
8
|
|
9
9
|
describe ".hooks" do
|
10
10
|
before do
|
@@ -12,11 +12,11 @@ describe Gitlab::Client do
|
|
12
12
|
@hooks = Gitlab.hooks
|
13
13
|
end
|
14
14
|
|
15
|
-
it "
|
15
|
+
it "gets the correct resource" do
|
16
16
|
expect(a_get("/hooks")).to have_been_made
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "returns a paginated response of system hooks" do
|
20
20
|
expect(@hooks).to be_a Gitlab::PaginatedResponse
|
21
21
|
expect(@hooks.first.url).to eq("http://example.com/hook")
|
22
22
|
end
|
@@ -28,11 +28,11 @@ describe Gitlab::Client do
|
|
28
28
|
@hook = Gitlab.add_hook("http://example.com/hook", token: 'secret-token')
|
29
29
|
end
|
30
30
|
|
31
|
-
it "
|
31
|
+
it "gets the correct resource" do
|
32
32
|
expect(a_post("/hooks").with(body: hash_including(token: 'secret-token'))).to have_been_made
|
33
33
|
end
|
34
34
|
|
35
|
-
it "
|
35
|
+
it "returns information about a added system hook" do
|
36
36
|
expect(@hook.url).to eq("http://example.com/hook")
|
37
37
|
end
|
38
38
|
end
|
@@ -43,11 +43,11 @@ describe Gitlab::Client do
|
|
43
43
|
@hook = Gitlab.hook(3)
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
46
|
+
it "gets the correct resource" do
|
47
47
|
expect(a_get("/hooks/3")).to have_been_made
|
48
48
|
end
|
49
49
|
|
50
|
-
it "
|
50
|
+
it "returns information about a added system hook" do
|
51
51
|
expect(@hook.url).to eq("http://example.com/hook")
|
52
52
|
end
|
53
53
|
end
|
@@ -58,11 +58,11 @@ describe Gitlab::Client do
|
|
58
58
|
@hook = Gitlab.delete_hook(3)
|
59
59
|
end
|
60
60
|
|
61
|
-
it "
|
61
|
+
it "gets the correct resource" do
|
62
62
|
expect(a_delete("/hooks/3")).to have_been_made
|
63
63
|
end
|
64
64
|
|
65
|
-
it "
|
65
|
+
it "returns information about a deleted system hook" do
|
66
66
|
expect(@hook.url).to eq("http://example.com/hook")
|
67
67
|
end
|
68
68
|
end
|