gitlab 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +195 -0
- data/README.md +12 -0
- data/lib/gitlab.rb +5 -0
- data/lib/gitlab/cli.rb +6 -0
- data/lib/gitlab/cli_helpers.rb +40 -3
- data/lib/gitlab/client.rb +1 -0
- data/lib/gitlab/client/labels.rb +55 -0
- data/lib/gitlab/client/merge_requests.rb +20 -2
- data/lib/gitlab/client/projects.rb +18 -9
- data/lib/gitlab/client/repositories.rb +84 -4
- data/lib/gitlab/configuration.rb +1 -1
- data/lib/gitlab/help.rb +2 -2
- data/lib/gitlab/objectified_hash.rb +4 -0
- data/lib/gitlab/request.rb +18 -6
- data/lib/gitlab/shell.rb +42 -4
- data/lib/gitlab/shell_history.rb +61 -0
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/compare_merge_request_diff.json +31 -0
- data/spec/fixtures/label.json +1 -0
- data/spec/fixtures/labels.json +1 -0
- data/spec/fixtures/{comment_merge_request.json → merge_request_comment.json} +0 -0
- data/spec/fixtures/project_commit_comment.json +1 -0
- data/spec/fixtures/project_commit_comments.json +1 -0
- data/spec/fixtures/project_tag_annotated.json +1 -0
- data/spec/fixtures/project_tag_lightweight.json +1 -0
- data/spec/fixtures/raw_file.json +2 -0
- data/spec/fixtures/shell_history.json +2 -0
- data/spec/fixtures/tree.json +1 -0
- data/spec/gitlab/client/branches_spec.rb +12 -31
- data/spec/gitlab/client/labels_spec.rb +68 -0
- data/spec/gitlab/client/merge_requests_spec.rb +39 -17
- data/spec/gitlab/client/projects_spec.rb +1 -1
- data/spec/gitlab/client/repositories_spec.rb +110 -5
- data/spec/gitlab/client/system_hooks_spec.rb +3 -3
- data/spec/gitlab/objectified_hash_spec.rb +19 -1
- data/spec/gitlab/request_spec.rb +4 -3
- data/spec/gitlab/shell_history_spec.rb +53 -0
- data/spec/gitlab_spec.rb +21 -1
- metadata +32 -21
- data/spec/fixtures/create_branch.json +0 -1
- data/spec/fixtures/create_merge_request.json +0 -1
- data/spec/fixtures/project_delete_key.json +0 -8
- data/spec/fixtures/protect_branch.json +0 -1
- data/spec/fixtures/system_hook_test.json +0 -1
- data/spec/fixtures/tag.json +0 -1
- data/spec/fixtures/unprotect_branch.json +0 -1
- data/spec/fixtures/update_merge_request.json +0 -1
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gitlab::Client do
|
4
|
+
describe ".labels" do
|
5
|
+
before do
|
6
|
+
stub_get("/projects/3/labels", "labels")
|
7
|
+
@labels = Gitlab.labels(3)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should get the correct resource" do
|
11
|
+
expect(a_get("/projects/3/labels")).to have_been_made
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return an array of project's labels" do
|
15
|
+
expect(@labels).to be_an Array
|
16
|
+
expect(@labels.first.name).to eq("Backlog")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".delete" do
|
21
|
+
before do
|
22
|
+
stub_delete("/projects/3/labels", "label")
|
23
|
+
@label = Gitlab.delete_label(3, "Backlog")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should get the correct resource" do
|
27
|
+
expect(a_delete("/projects/3/labels").
|
28
|
+
with(:body => {:name => 'Backlog'})).to have_been_made
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should return information about a deleted snippet" do
|
32
|
+
expect(@label.name).to eq("Backlog")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe ".edit_label" do
|
37
|
+
before do
|
38
|
+
stub_put("/projects/3/labels", "label")
|
39
|
+
@label = Gitlab.edit_label(3, "TODO", :new_name => 'Backlog')
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should get the correct resource" do
|
43
|
+
expect(a_put("/projects/3/labels").
|
44
|
+
with(:body => {:name => 'TODO', :new_name => "Backlog"})).to have_been_made
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should return information about an edited label" do
|
48
|
+
expect(@label.name).to eq("Backlog")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe ".create_label" do
|
53
|
+
before do
|
54
|
+
stub_post("/projects/3/labels", "label")
|
55
|
+
@label = Gitlab.create_label(3, 'Backlog', '#DD10AA')
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should get the correct resource" do
|
59
|
+
expect(a_post("/projects/3/labels").
|
60
|
+
with(:body => {:name => 'Backlog', :color => '#DD10AA'})).to have_been_made
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should return information about a created label" do
|
64
|
+
expect(@label.name).to eq('Backlog')
|
65
|
+
expect(@label.color).to eq('#DD10AA')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -35,7 +35,7 @@ describe Gitlab::Client do
|
|
35
35
|
|
36
36
|
describe ".create_merge_request" do
|
37
37
|
before do
|
38
|
-
stub_post("/projects/3/merge_requests", "
|
38
|
+
stub_post("/projects/3/merge_requests", "merge_request")
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should fail if it doesn't have a source_branch" do
|
@@ -57,13 +57,17 @@ describe Gitlab::Client do
|
|
57
57
|
)
|
58
58
|
expect(@merge_request.project_id).to eq(3)
|
59
59
|
expect(@merge_request.assignee.name).to eq("Jack Smith")
|
60
|
-
expect(@merge_request.title).to eq('New feature')
|
61
60
|
end
|
62
61
|
end
|
63
62
|
|
64
63
|
describe ".update_merge_request" do
|
65
64
|
before do
|
66
|
-
stub_put("/projects/3/merge_request/2", "
|
65
|
+
stub_put("/projects/3/merge_request/2", "merge_request").
|
66
|
+
with(:body => {
|
67
|
+
:assignee_id => '1',
|
68
|
+
:target_branch => 'master',
|
69
|
+
:title => 'A different new feature'
|
70
|
+
})
|
67
71
|
@merge_request = Gitlab.update_merge_request(3, 2,
|
68
72
|
:assignee_id => '1',
|
69
73
|
:target_branch => 'master',
|
@@ -71,26 +75,36 @@ describe Gitlab::Client do
|
|
71
75
|
)
|
72
76
|
end
|
73
77
|
|
78
|
+
it "should get the correct resource" do
|
79
|
+
expect(a_put("/projects/3/merge_request/2").
|
80
|
+
with(:body => {
|
81
|
+
:assignee_id => '1',
|
82
|
+
:target_branch => 'master',
|
83
|
+
:title => 'A different new feature'
|
84
|
+
})).to have_been_made
|
85
|
+
end
|
86
|
+
|
74
87
|
it "should return information about a merge request" do
|
75
88
|
expect(@merge_request.project_id).to eq(3)
|
76
89
|
expect(@merge_request.assignee.name).to eq("Jack Smith")
|
77
|
-
expect(@merge_request.title).to eq('A different new feature')
|
78
90
|
end
|
79
91
|
end
|
80
92
|
|
81
|
-
describe ".
|
93
|
+
describe ".accept_merge_request" do
|
82
94
|
before do
|
83
|
-
|
84
|
-
|
95
|
+
stub_put("/projects/5/merge_request/42/merge", "merge_request").
|
96
|
+
with(:body => {:merge_commit_message => 'Nice!'})
|
97
|
+
@merge_request = Gitlab.accept_merge_request(5, 42, :merge_commit_message => 'Nice!')
|
85
98
|
end
|
86
99
|
|
87
|
-
it "should
|
88
|
-
expect(
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
expect(@merge_request
|
100
|
+
it "should get the correct resource" do
|
101
|
+
expect(a_put("/projects/5/merge_request/42/merge").
|
102
|
+
with(:body => {:merge_commit_message => 'Nice!'})).to have_been_made
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should return information about merged merge request" do
|
106
|
+
expect(@merge_request.project_id).to eq(3)
|
107
|
+
expect(@merge_request.assignee.name).to eq("Jack Smith")
|
94
108
|
end
|
95
109
|
end
|
96
110
|
|
@@ -100,6 +114,10 @@ describe Gitlab::Client do
|
|
100
114
|
@merge_request = Gitlab.merge_request_comments(3, 2)
|
101
115
|
end
|
102
116
|
|
117
|
+
it "should get the correct resource" do
|
118
|
+
expect(a_get("/projects/3/merge_request/2/comments")).to have_been_made
|
119
|
+
end
|
120
|
+
|
103
121
|
it "should return merge request's comments" do
|
104
122
|
expect(@merge_request).to be_an Array
|
105
123
|
expect(@merge_request.length).to eq(2)
|
@@ -112,13 +130,17 @@ describe Gitlab::Client do
|
|
112
130
|
|
113
131
|
describe ".create_merge_request_comment" do
|
114
132
|
before do
|
115
|
-
stub_post("/projects/3/merge_request/2/comments", "
|
133
|
+
stub_post("/projects/3/merge_request/2/comments", "merge_request_comment")
|
134
|
+
@merge_request = Gitlab.create_merge_request_comment(3, 2, 'Cool Merge Request!')
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should get the correct resource" do
|
138
|
+
expect(a_post("/projects/3/merge_request/2/comments")).to have_been_made
|
116
139
|
end
|
117
140
|
|
118
141
|
it "should return information about a merge request" do
|
119
|
-
@merge_request = Gitlab.create_merge_request_comment(3, 2, 'Cool Merge Request!')
|
120
142
|
expect(@merge_request.note).to eq('Cool Merge Request!')
|
121
|
-
@merge_request.author.id
|
143
|
+
expect(@merge_request.author.id).to eq(1)
|
122
144
|
end
|
123
145
|
end
|
124
146
|
end
|
@@ -342,7 +342,7 @@ describe Gitlab::Client do
|
|
342
342
|
|
343
343
|
describe ".delete_deploy_key" do
|
344
344
|
before do
|
345
|
-
stub_delete("/projects/42/keys/2", "
|
345
|
+
stub_delete("/projects/42/keys/2", "project_key")
|
346
346
|
@deploy_key = Gitlab.delete_deploy_key(42, 2)
|
347
347
|
end
|
348
348
|
|
@@ -8,6 +8,10 @@ describe Gitlab::Client do
|
|
8
8
|
it { should respond_to :repo_commits }
|
9
9
|
it { should respond_to :repo_commit }
|
10
10
|
it { should respond_to :repo_commit_diff }
|
11
|
+
it { should respond_to :repo_commit_comments }
|
12
|
+
it { should respond_to :repo_create_commit_comment }
|
13
|
+
it { should respond_to :repo_tree }
|
14
|
+
it { should respond_to :repo_compare}
|
11
15
|
|
12
16
|
describe ".tags" do
|
13
17
|
before do
|
@@ -25,18 +29,68 @@ describe Gitlab::Client do
|
|
25
29
|
end
|
26
30
|
end
|
27
31
|
|
32
|
+
describe ".file_contents" do
|
33
|
+
before do
|
34
|
+
stub_get("/projects/3/repository/blobs/master?filepath=Gemfile", "raw_file")
|
35
|
+
@file_contents = Gitlab.file_contents(3, "Gemfile")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should get the correct resource" do
|
39
|
+
expect(a_get("/projects/3/repository/blobs/master?filepath=Gemfile")).to have_been_made
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return file contents" do
|
43
|
+
expect(@file_contents).to eq("source 'https://rubygems.org'\ngem 'rails', '4.1.2'\n")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
28
47
|
describe ".create_tag" do
|
48
|
+
context "when lightweight" do
|
49
|
+
before do
|
50
|
+
stub_post("/projects/3/repository/tags", "project_tag_lightweight")
|
51
|
+
@tag = Gitlab.create_tag(3, 'v1.0.0', '2695effb5807a22ff3d138d593fd856244e155e7')
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should get the correct resource" do
|
55
|
+
expect(a_post("/projects/3/repository/tags")).to have_been_made
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should return information about a new repository tag" do
|
59
|
+
expect(@tag.name).to eq("v1.0.0")
|
60
|
+
expect(@tag.message).to eq(nil)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "when annotated" do
|
65
|
+
before do
|
66
|
+
stub_post("/projects/3/repository/tags", "project_tag_annotated")
|
67
|
+
@tag = Gitlab.create_tag(3, 'v1.1.0', '2695effb5807a22ff3d138d593fd856244e155e7', 'Release 1.1.0')
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should get the correct resource" do
|
71
|
+
expect(a_post("/projects/3/repository/tags")).to have_been_made
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should return information about a new repository tag" do
|
75
|
+
expect(@tag.name).to eq("v1.1.0")
|
76
|
+
expect(@tag.message).to eq("Release 1.1.0")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe ".tree" do
|
29
82
|
before do
|
30
|
-
|
31
|
-
@
|
83
|
+
stub_get("/projects/3/repository/tree", "tree")
|
84
|
+
@tree = Gitlab.tree(3)
|
32
85
|
end
|
33
86
|
|
34
87
|
it "should get the correct resource" do
|
35
|
-
expect(
|
88
|
+
expect(a_get("/projects/3/repository/tree")).to have_been_made
|
36
89
|
end
|
37
90
|
|
38
|
-
it "should return
|
39
|
-
expect(@
|
91
|
+
it "should return an array of repository tree files (root level)" do
|
92
|
+
expect(@tree).to be_an Array
|
93
|
+
expect(@tree.first.name).to eq("app")
|
40
94
|
end
|
41
95
|
end
|
42
96
|
|
@@ -89,4 +143,55 @@ describe Gitlab::Client do
|
|
89
143
|
expect(@diff.new_path).to eq("doc/update/5.4-to-6.0.md")
|
90
144
|
end
|
91
145
|
end
|
146
|
+
|
147
|
+
describe ".commit_comments" do
|
148
|
+
before do
|
149
|
+
stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments", "project_commit_comments")
|
150
|
+
@commit_comments = Gitlab.commit_comments(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should get the correct resource" do
|
154
|
+
expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments"))
|
155
|
+
.to have_been_made
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should return commit's comments" do
|
159
|
+
expect(@commit_comments).to be_an Array
|
160
|
+
expect(@commit_comments.length).to eq(2)
|
161
|
+
expect(@commit_comments[0].note).to eq("this is the 1st comment on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6")
|
162
|
+
expect(@commit_comments[0].author.id).to eq(11)
|
163
|
+
expect(@commit_comments[1].note).to eq("another discussion point on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6")
|
164
|
+
expect(@commit_comments[1].author.id).to eq(12)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
describe ".create_commit_comment" do
|
169
|
+
before do
|
170
|
+
stub_post("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments", "project_commit_comment")
|
171
|
+
@merge_request = Gitlab.create_commit_comment(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'Nice code!')
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should return information about the newly created comment" do
|
175
|
+
expect(@merge_request.note).to eq('Nice code!')
|
176
|
+
expect(@merge_request.author.id).to eq(1)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe ".compare" do
|
181
|
+
before do
|
182
|
+
stub_get("/projects/3/repository/compare", "compare_merge_request_diff").
|
183
|
+
with(:query => {:from => "master", :to => "feature"})
|
184
|
+
@diff = Gitlab.compare(3, 'master', 'feature')
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should get the correct resource" do
|
188
|
+
expect(a_get("/projects/3/repository/compare").
|
189
|
+
with(:query => {:from => "master", :to => "feature"})).to have_been_made
|
190
|
+
end
|
191
|
+
|
192
|
+
it "should get diffs of a merge request" do
|
193
|
+
expect(@diff.diffs).to be_kind_of Array
|
194
|
+
expect(@diff.diffs.last["new_path"]).to eq "files/js/application.js"
|
195
|
+
end
|
196
|
+
end
|
92
197
|
end
|
@@ -39,16 +39,16 @@ describe Gitlab::Client do
|
|
39
39
|
|
40
40
|
describe ".hook" do
|
41
41
|
before do
|
42
|
-
stub_get("/hooks/3", "
|
42
|
+
stub_get("/hooks/3", "system_hook")
|
43
43
|
@hook = Gitlab.hook(3)
|
44
44
|
end
|
45
|
+
|
45
46
|
it "should get the correct resource" do
|
46
47
|
expect(a_get("/hooks/3")).to have_been_made
|
47
48
|
end
|
48
49
|
|
49
50
|
it "should return information about a added system hook" do
|
50
|
-
expect(@hook.
|
51
|
-
expect(@hook.project_id).to eq(1)
|
51
|
+
expect(@hook.url).to eq("http://example.com/hook")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Gitlab::ObjectifiedHash do
|
4
4
|
before do
|
5
|
-
@hash = {a: 1, b: 2}
|
5
|
+
@hash = {a: 1, b: 2, 'string' => 'string', symbol: :symbol}
|
6
6
|
@oh = Gitlab::ObjectifiedHash.new @hash
|
7
7
|
end
|
8
8
|
|
@@ -20,4 +20,22 @@ describe Gitlab::ObjectifiedHash do
|
|
20
20
|
expect(@oh.respond_to?(:to_h)).to be_truthy
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
describe "#respond_to" do
|
25
|
+
it "should return true for methods this object responds to through method_missing as sym" do
|
26
|
+
expect(@oh.respond_to?(:a)).to be_truthy
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should return true for methods this object responds to through method_missing as string" do
|
30
|
+
expect(@oh.respond_to?('string')).to be_truthy
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not care if you use a string or symbol to reference a method" do
|
34
|
+
expect(@oh.respond_to?(:string)).to be_truthy
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should not care if you use a string or symbol to reference a method" do
|
38
|
+
expect(@oh.respond_to?('symbol')).to be_truthy
|
39
|
+
end
|
40
|
+
end
|
23
41
|
end
|
data/spec/gitlab/request_spec.rb
CHANGED
@@ -34,9 +34,10 @@ describe Gitlab::Request do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
context "when endpoint is set" do
|
37
|
-
it "should set
|
38
|
-
Gitlab::Request.new
|
39
|
-
|
37
|
+
it "should set instance variable 'endpoint'" do
|
38
|
+
request = Gitlab::Request.new
|
39
|
+
request.set_request_defaults('http://rabbit-hole.example.org', 1234000)
|
40
|
+
expect(request.instance_variable_get(:@endpoint)).to eq("http://rabbit-hole.example.org")
|
40
41
|
end
|
41
42
|
|
42
43
|
it "should set default_params" do
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
describe Gitlab::Shell::History do
|
5
|
+
context 'saving to a file' do
|
6
|
+
before do
|
7
|
+
@file = Tempfile.new('.gitlab_shell_history')
|
8
|
+
@history = Gitlab::Shell::History.new(file_path: @file.path)
|
9
|
+
end
|
10
|
+
|
11
|
+
after do @file.close(true) end
|
12
|
+
|
13
|
+
it 'saves the lines' do
|
14
|
+
@history << 'party on, dudes'
|
15
|
+
@history << 'be excellent to each other'
|
16
|
+
@history.save
|
17
|
+
expect(File.read @file.path).
|
18
|
+
to eq("party on, dudes\nbe excellent to each other\n")
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'has the lines' do
|
22
|
+
@history << 'party on, dudes'
|
23
|
+
@history << 'be excellent to each other'
|
24
|
+
expect(@history.lines).
|
25
|
+
to eq(["party on, dudes", "be excellent to each other"])
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'limits the lines to GITLAB_HISTFILESIZE' do
|
29
|
+
ENV['GITLAB_HISTFILESIZE'] = '2'
|
30
|
+
@history << 'bogus'
|
31
|
+
@history << 'party on, dudes'
|
32
|
+
@history << 'be excellent to each other'
|
33
|
+
@history.save
|
34
|
+
expect(@history.lines).
|
35
|
+
to eq(["party on, dudes", "be excellent to each other"])
|
36
|
+
expect(File.read @file.path).
|
37
|
+
to eq("party on, dudes\nbe excellent to each other\n")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'loading a file' do
|
42
|
+
before do
|
43
|
+
@file = load_fixture('shell_history')
|
44
|
+
@history = Gitlab::Shell::History.new(file_path: @file.path)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'has the lines' do
|
48
|
+
@history.load
|
49
|
+
expect(@history.lines).
|
50
|
+
to eq(["party on, dudes", "be excellent to each other"])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/spec/gitlab_spec.rb
CHANGED
@@ -7,6 +7,15 @@ describe Gitlab do
|
|
7
7
|
it "should be a Gitlab::Client" do
|
8
8
|
expect(Gitlab.client).to be_a Gitlab::Client
|
9
9
|
end
|
10
|
+
|
11
|
+
it "should not override each other" do
|
12
|
+
client1 = Gitlab.client(endpoint: 'https://api1.example.com', private_token: '001')
|
13
|
+
client2 = Gitlab.client(endpoint: 'https://api2.example.com', private_token: '002')
|
14
|
+
expect(client1.endpoint).to eq('https://api1.example.com')
|
15
|
+
expect(client2.endpoint).to eq('https://api2.example.com')
|
16
|
+
expect(client1.private_token).to eq('001')
|
17
|
+
expect(client2.private_token).to eq('002')
|
18
|
+
end
|
10
19
|
end
|
11
20
|
|
12
21
|
describe ".actions" do
|
@@ -14,7 +23,7 @@ describe Gitlab do
|
|
14
23
|
actions = Gitlab.actions
|
15
24
|
expect(actions).to be_an Array
|
16
25
|
expect(actions.first).to be_a Symbol
|
17
|
-
expect(actions.sort.first).to
|
26
|
+
expect(actions.sort.first).to eq(:accept_merge_request)
|
18
27
|
end
|
19
28
|
end
|
20
29
|
|
@@ -62,4 +71,15 @@ describe Gitlab do
|
|
62
71
|
end
|
63
72
|
end
|
64
73
|
end
|
74
|
+
|
75
|
+
describe ".http_proxy" do
|
76
|
+
it "delegates the method to Gitlab::Request" do
|
77
|
+
Gitlab.endpoint = 'https://api.example.com'
|
78
|
+
request = class_spy(Gitlab::Request).as_stubbed_const
|
79
|
+
|
80
|
+
Gitlab.http_proxy('fazbearentertainment.com', 1987, 'ffazbear', 'itsme')
|
81
|
+
expect(request).to have_received(:http_proxy).
|
82
|
+
with('fazbearentertainment.com', 1987, 'ffazbear', 'itsme')
|
83
|
+
end
|
84
|
+
end
|
65
85
|
end
|