octokit 1.17.0 → 1.17.1
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.
- data/CHANGELOG.md +1 -0
- data/README.md +8 -0
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +1 -1
- data/spec/faraday/response_spec.rb +6 -6
- data/spec/helper.rb +7 -0
- data/spec/octokit/client/authorizations_spec.rb +12 -12
- data/spec/octokit/client/commits_spec.rb +31 -31
- data/spec/octokit/client/contents_spec.rb +10 -10
- data/spec/octokit/client/downloads_spec.rb +11 -11
- data/spec/octokit/client/emojis_spec.rb +2 -2
- data/spec/octokit/client/events_spec.rb +8 -8
- data/spec/octokit/client/gists_spec.rb +26 -26
- data/spec/octokit/client/issue_events_spec.rb +6 -6
- data/spec/octokit/client/issues_spec.rb +30 -30
- data/spec/octokit/client/labels_spec.rb +28 -28
- data/spec/octokit/client/markdown_spec.rb +2 -2
- data/spec/octokit/client/milestones_spec.rb +10 -10
- data/spec/octokit/client/objects_spec.rb +11 -11
- data/spec/octokit/client/organizations_spec.rb +41 -41
- data/spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb +2 -2
- data/spec/octokit/client/pub_sub_hubbub_spec.rb +4 -4
- data/spec/octokit/client/pulls_spec.rb +20 -20
- data/spec/octokit/client/refs_spec.rb +15 -15
- data/spec/octokit/client/repositories_spec.rb +83 -83
- data/spec/octokit/client/statuses_spec.rb +6 -6
- data/spec/octokit/client/users_spec.rb +48 -48
- data/spec/octokit/client_spec.rb +27 -27
- data/spec/octokit/gist_spec.rb +14 -14
- data/spec/octokit_spec.rb +6 -6
- data/spec/repository_spec.rb +21 -21
- metadata +9 -9
@@ -7,27 +7,27 @@ describe Octokit::Client::Statuses do
|
|
7
7
|
@client = Octokit::Client.new(:login => 'sferik')
|
8
8
|
end
|
9
9
|
|
10
|
-
describe
|
10
|
+
describe ".statuses" do
|
11
11
|
|
12
|
-
it
|
12
|
+
it "lists commit statuses" do
|
13
13
|
stub_get('https://api.github.com/repos/pengwynn/octokit/statuses/7d069dedd4cb56bf57760688657abd0e6b5a28b8').
|
14
14
|
to_return(:body => fixture('v3/statuses.json'))
|
15
15
|
statuses = @client.statuses('pengwynn/octokit', '7d069dedd4cb56bf57760688657abd0e6b5a28b8')
|
16
|
-
statuses.first.target_url.
|
16
|
+
expect(statuses.first.target_url).to eq('http://travis-ci.org/pengwynn/octokit/builds/2092930')
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
|
-
describe
|
21
|
+
describe ".create_status" do
|
22
22
|
|
23
|
-
it
|
23
|
+
it "creates status" do
|
24
24
|
stub_post('https://api.github.com/repos/pengwynn/octokit/statuses/7d069dedd4cb56bf57760688657abd0e6b5a28b8').
|
25
25
|
to_return(:body => fixture('v3/status.json'))
|
26
26
|
info = {
|
27
27
|
:target_url => 'http://wynnnetherland.com'
|
28
28
|
}
|
29
29
|
status = @client.create_status('pengwynn/octokit', '7d069dedd4cb56bf57760688657abd0e6b5a28b8', 'success', info)
|
30
|
-
status.target_url.
|
30
|
+
expect(status.target_url).to eq('http://wynnnetherland.com')
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
@@ -11,11 +11,11 @@ describe Octokit::Client::Users do
|
|
11
11
|
|
12
12
|
context "with a username passed" do
|
13
13
|
|
14
|
-
it "
|
14
|
+
it "returns matching username" do
|
15
15
|
stub_get("https://api.github.com/legacy/user/search/sferik").
|
16
16
|
to_return(:body => fixture("legacy/users.json"))
|
17
17
|
users = @client.search_users("sferik")
|
18
|
-
users.first.username.
|
18
|
+
expect(users.first.username).to eq("sferik")
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
@@ -26,22 +26,22 @@ describe Octokit::Client::Users do
|
|
26
26
|
|
27
27
|
context "with a username passed" do
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "returns the user" do
|
30
30
|
stub_get("/users/sferik").
|
31
31
|
to_return(:body => fixture("v3/user.json"))
|
32
32
|
user = @client.user("sferik")
|
33
|
-
user.login.
|
33
|
+
expect(user.login).to eq("sferik")
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context "without a username passed" do
|
39
39
|
|
40
|
-
it "
|
40
|
+
it "returns the authenticated user" do
|
41
41
|
stub_get("/user").
|
42
42
|
to_return(:body => fixture("v3/user.json"))
|
43
43
|
user = @client.user
|
44
|
-
user.login.
|
44
|
+
expect(user.login).to eq("sferik")
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
@@ -52,12 +52,12 @@ describe Octokit::Client::Users do
|
|
52
52
|
|
53
53
|
context "with a location passed" do
|
54
54
|
|
55
|
-
it "
|
55
|
+
it "updates the user's location" do
|
56
56
|
stub_patch("/user").
|
57
57
|
with(:body => {:name => "Erik Michaels-Ober", :email => "sferik@gmail.com", :company => "Code for America", :location => "San Francisco", :hireable => false}).
|
58
58
|
to_return(:body => fixture("v3/user.json"))
|
59
59
|
user = @client.update_user(:name => "Erik Michaels-Ober", :email => "sferik@gmail.com", :company => "Code for America", :location => "San Francisco", :hireable => false)
|
60
|
-
user.login.
|
60
|
+
expect(user.login).to eq("sferik")
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
@@ -68,22 +68,22 @@ describe Octokit::Client::Users do
|
|
68
68
|
|
69
69
|
context "with a username passed" do
|
70
70
|
|
71
|
-
it "
|
71
|
+
it "returns the user's followers" do
|
72
72
|
stub_get("https://api.github.com/users/sferik/followers").
|
73
73
|
to_return(:body => fixture("v3/followers.json"))
|
74
74
|
users = @client.followers("sferik")
|
75
|
-
users.first.login.
|
75
|
+
expect(users.first.login).to eq("puls")
|
76
76
|
end
|
77
77
|
|
78
78
|
end
|
79
79
|
|
80
80
|
context "without a username passed" do
|
81
81
|
|
82
|
-
it "
|
82
|
+
it "returns the user's followers" do
|
83
83
|
stub_get("https://api.github.com/users/sferik/followers").
|
84
84
|
to_return(:body => fixture("v3/followers.json"))
|
85
85
|
users = @client.followers
|
86
|
-
users.first.login.
|
86
|
+
expect(users.first.login).to eq("puls")
|
87
87
|
end
|
88
88
|
|
89
89
|
end
|
@@ -94,22 +94,22 @@ describe Octokit::Client::Users do
|
|
94
94
|
|
95
95
|
context "with a username passed" do
|
96
96
|
|
97
|
-
it "
|
97
|
+
it "returns the user's following" do
|
98
98
|
stub_get("https://api.github.com/users/sferik/following").
|
99
99
|
to_return(:body => fixture("v3/following.json"))
|
100
100
|
users = @client.following("sferik")
|
101
|
-
users.first.login.
|
101
|
+
expect(users.first.login).to eq("rails")
|
102
102
|
end
|
103
103
|
|
104
104
|
end
|
105
105
|
|
106
106
|
context "without a username passed" do
|
107
107
|
|
108
|
-
it "
|
108
|
+
it "returns the user's following" do
|
109
109
|
stub_get("https://api.github.com/users/sferik/following").
|
110
110
|
to_return(:body => fixture("v3/following.json"))
|
111
111
|
users = @client.following
|
112
|
-
users.first.login.
|
112
|
+
expect(users.first.login).to eq("rails")
|
113
113
|
end
|
114
114
|
|
115
115
|
end
|
@@ -120,22 +120,22 @@ describe Octokit::Client::Users do
|
|
120
120
|
|
121
121
|
context "with one user following another" do
|
122
122
|
|
123
|
-
it "
|
123
|
+
it "returns true" do
|
124
124
|
stub_get("https://api.github.com/user/following/puls").
|
125
125
|
to_return(:status => 204, :body => "")
|
126
126
|
follows = @client.follows?("sferik", "puls")
|
127
|
-
follows.
|
127
|
+
expect(follows).to be_true
|
128
128
|
end
|
129
129
|
|
130
130
|
end
|
131
131
|
|
132
132
|
context "with one user not following another" do
|
133
133
|
|
134
|
-
it "
|
134
|
+
it "returns false" do
|
135
135
|
stub_get("https://api.github.com/user/following/dogbrainz").
|
136
136
|
to_return(:status => 404, :body => "")
|
137
137
|
follows = @client.follows?("sferik", "dogbrainz")
|
138
|
-
follows.
|
138
|
+
expect(follows).to be_false
|
139
139
|
end
|
140
140
|
|
141
141
|
end
|
@@ -144,22 +144,22 @@ describe Octokit::Client::Users do
|
|
144
144
|
|
145
145
|
describe ".follow" do
|
146
146
|
|
147
|
-
it "
|
147
|
+
it "follows a user" do
|
148
148
|
stub_put("https://api.github.com/user/following/dianakimball").
|
149
149
|
to_return(:status => 204, :body => "")
|
150
150
|
following = @client.follow("dianakimball")
|
151
|
-
following.
|
151
|
+
expect(following).to be_true
|
152
152
|
end
|
153
153
|
|
154
154
|
end
|
155
155
|
|
156
156
|
describe ".unfollow" do
|
157
157
|
|
158
|
-
it "
|
158
|
+
it "unfollows a user" do
|
159
159
|
stub_delete("https://api.github.com/user/following/dogbrainz").
|
160
160
|
to_return(:status => 204, :body => "")
|
161
161
|
following = @client.unfollow("dogbrainz")
|
162
|
-
following.
|
162
|
+
expect(following).to be_true
|
163
163
|
end
|
164
164
|
|
165
165
|
end
|
@@ -168,22 +168,22 @@ describe Octokit::Client::Users do
|
|
168
168
|
|
169
169
|
context "with on user starring a repo" do
|
170
170
|
|
171
|
-
it "
|
171
|
+
it "returns true" do
|
172
172
|
stub_get("https://api.github.com/user/starred/sferik/rails_admin").
|
173
173
|
to_return(:status => 204, :body => "")
|
174
174
|
starred = @client.starred?("sferik", "rails_admin")
|
175
|
-
starred.
|
175
|
+
expect(starred).to be_true
|
176
176
|
end
|
177
177
|
|
178
178
|
end
|
179
179
|
|
180
180
|
context "with on user not starring a repo" do
|
181
181
|
|
182
|
-
it "
|
182
|
+
it "returns false" do
|
183
183
|
stub_get("https://api.github.com/user/starred/sferik/dogbrainz").
|
184
184
|
to_return(:status => 404, :body => "")
|
185
185
|
starred = @client.starred?("sferik", "dogbrainz")
|
186
|
-
starred.
|
186
|
+
expect(starred).to be_false
|
187
187
|
end
|
188
188
|
|
189
189
|
end
|
@@ -194,22 +194,22 @@ describe Octokit::Client::Users do
|
|
194
194
|
|
195
195
|
context "with a username passed" do
|
196
196
|
|
197
|
-
it "
|
197
|
+
it "returns starred repositories" do
|
198
198
|
stub_get("https://api.github.com/users/sferik/starred").
|
199
199
|
to_return(:body => fixture("v3/starred.json"))
|
200
200
|
repositories = @client.starred("sferik")
|
201
|
-
repositories.first.name.
|
201
|
+
expect(repositories.first.name).to eq("grit")
|
202
202
|
end
|
203
203
|
|
204
204
|
end
|
205
205
|
|
206
206
|
context "without a username passed" do
|
207
207
|
|
208
|
-
it "
|
208
|
+
it "returns starred repositories" do
|
209
209
|
stub_get("https://api.github.com/users/sferik/starred").
|
210
210
|
to_return(:body => fixture("v3/starred.json"))
|
211
211
|
repositories = @client.starred
|
212
|
-
repositories.first.name.
|
212
|
+
expect(repositories.first.name).to eq("grit")
|
213
213
|
end
|
214
214
|
|
215
215
|
end
|
@@ -220,22 +220,22 @@ describe Octokit::Client::Users do
|
|
220
220
|
|
221
221
|
context "with a username passed" do
|
222
222
|
|
223
|
-
it "
|
223
|
+
it "returns watched repositories" do
|
224
224
|
stub_get("https://api.github.com/users/sferik/watched").
|
225
225
|
to_return(:body => fixture("v3/watched.json"))
|
226
226
|
repositories = @client.watched("sferik")
|
227
|
-
repositories.first.name.
|
227
|
+
expect(repositories.first.name).to eq("grit")
|
228
228
|
end
|
229
229
|
|
230
230
|
end
|
231
231
|
|
232
232
|
context "without a username passed" do
|
233
233
|
|
234
|
-
it "
|
234
|
+
it "returns watched repositories" do
|
235
235
|
stub_get("https://api.github.com/users/sferik/watched").
|
236
236
|
to_return(:body => fixture("v3/watched.json"))
|
237
237
|
repositories = @client.watched
|
238
|
-
repositories.first.name.
|
238
|
+
expect(repositories.first.name).to eq("grit")
|
239
239
|
end
|
240
240
|
|
241
241
|
end
|
@@ -244,69 +244,69 @@ describe Octokit::Client::Users do
|
|
244
244
|
|
245
245
|
describe ".keys" do
|
246
246
|
|
247
|
-
it "
|
247
|
+
it "returns public keys" do
|
248
248
|
stub_get("https://api.github.com/user/keys").
|
249
249
|
to_return(:body => fixture("v3/public_keys.json"))
|
250
250
|
public_keys = @client.keys
|
251
|
-
public_keys.first.id.
|
251
|
+
expect(public_keys.first.id).to eq(103205)
|
252
252
|
end
|
253
253
|
|
254
254
|
end
|
255
255
|
|
256
256
|
describe ".add_key" do
|
257
257
|
|
258
|
-
it "
|
258
|
+
it "adds a public key" do
|
259
259
|
title, key = "Moss", "ssh-dss AAAAB3NzaC1kc3MAAACBAJz7HanBa18ad1YsdFzHO5Wy1/WgXd4BV+czbKq7q23jungbfjN3eo2a0SVdxux8GG+RZ9ia90VD/X+PE4s3LV60oXZ7PDAuyPO1CTF0TaDoKf9mPaHcPa6agMJVocMsgBgwviWT1Q9VgN1SccDsYVDtxkIAwuw25YeHZlG6myx1AAAAFQCgW+OvXWUdUJPBGkRJ8ML7uf0VHQAAAIAlP5G96tTss0SKYVSCJCyocn9cyGQdNjxah4/aYuYFTbLI1rxk7sr/AkZfJNIoF2UFyO5STbbratykIQGUPdUBg1a2t72bu31x+4ZYJMngNsG/AkZ2oqLiH6dJKHD7PFx2oSPalogwsUV7iSMIZIYaPa03A9763iFsN0qJjaed+gAAAIBxz3Prxdzt/os4XGXSMNoWcS03AFC/05NOkoDMrXxQnTTpp1wrOgyRqEnKz15qC5dWk1ynzK+LJXHDZGA8lXPfCjHpJO3zrlZ/ivvLhgPdDpt13MAhIJFH06hTal0woxbk/fIdY71P3kbgXC0Ppx/0S7BC+VxqRCA4/wcM+BoDbA== host"
|
260
260
|
stub_post("https://api.github.com/user/keys").
|
261
261
|
with(:title => title, :key => key).
|
262
262
|
to_return(:status => 201, :body => fixture("v3/public_key.json"))
|
263
263
|
public_key = @client.add_key(title, key)
|
264
|
-
public_key.id.
|
264
|
+
expect(public_key.id).to eq(103205)
|
265
265
|
end
|
266
266
|
|
267
267
|
end
|
268
268
|
|
269
269
|
describe ".remove_key" do
|
270
270
|
|
271
|
-
it "
|
271
|
+
it "removes a public key" do
|
272
272
|
stub_delete("https://api.github.com/user/keys/103205").
|
273
273
|
to_return(:status => 204, :body => "")
|
274
274
|
response = @client.remove_key(103205)
|
275
|
-
response.
|
275
|
+
expect(response).to be_true
|
276
276
|
end
|
277
277
|
|
278
278
|
end
|
279
279
|
|
280
280
|
describe ".emails" do
|
281
281
|
|
282
|
-
it "
|
282
|
+
it "returns email addresses" do
|
283
283
|
stub_get("https://api.github.com/user/emails").
|
284
284
|
to_return(:body => fixture("v3/emails.json"))
|
285
285
|
emails = @client.emails
|
286
|
-
emails.first.
|
286
|
+
expect(emails.first).to eq("sferik@gmail.com")
|
287
287
|
end
|
288
288
|
|
289
289
|
end
|
290
290
|
|
291
291
|
describe ".add_email" do
|
292
292
|
|
293
|
-
it "
|
293
|
+
it "adds an email address" do
|
294
294
|
stub_post("https://api.github.com/user/emails").
|
295
295
|
with(:email => "sferik@gmail.com").
|
296
296
|
to_return(:body => fixture("v3/emails.json"))
|
297
297
|
emails = @client.add_email("sferik@gmail.com")
|
298
|
-
emails.first.
|
298
|
+
expect(emails.first).to eq("sferik@gmail.com")
|
299
299
|
end
|
300
300
|
|
301
301
|
end
|
302
302
|
|
303
303
|
describe ".remove_email" do
|
304
304
|
|
305
|
-
it "
|
305
|
+
it "removes an email address" do
|
306
306
|
stub_delete("https://api.github.com/user/emails?email=sferik@gmail.com").
|
307
307
|
to_return(:status => 204, :body => "")
|
308
308
|
response = @client.remove_email("sferik@gmail.com")
|
309
|
-
response.
|
309
|
+
expect(response).to be_true
|
310
310
|
end
|
311
311
|
|
312
312
|
end
|
data/spec/octokit/client_spec.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
describe Octokit::Client do
|
4
|
-
it
|
4
|
+
it "works with basic auth and password" do
|
5
5
|
stub_get("https://foo:bar@api.github.com/repos/baz/quux/commits?per_page=35&sha=master").
|
6
6
|
with(:headers => {'Accept'=>'*/*'}).
|
7
7
|
to_return(:status => 200, :body => '{"commits":[]}', :headers => {})
|
8
|
-
|
8
|
+
expect {
|
9
9
|
Octokit::Client.new(:login => 'foo', :password => 'bar').commits('baz/quux')
|
10
|
-
}.
|
10
|
+
}.not_to raise_exception
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
13
|
+
it "configures faraday from faraday_config_block" do
|
14
14
|
mw_evaluated = false
|
15
15
|
Octokit.configure do |c|
|
16
16
|
c.faraday_config { |f| mw_evaluated = true }
|
@@ -20,13 +20,13 @@ describe Octokit::Client do
|
|
20
20
|
{ 'X-RateLimit-Limit' => 5000, 'X-RateLimit-Remaining' => 5000})
|
21
21
|
client = Octokit::Client.new()
|
22
22
|
client.rate_limit
|
23
|
-
mw_evaluated.
|
23
|
+
expect(mw_evaluated).to be_true
|
24
24
|
end
|
25
25
|
|
26
26
|
|
27
27
|
describe "auto_traversal" do
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "traverses a paginated response using the maximum allowed number of items per page" do
|
30
30
|
stub_get("https://api.github.com/foo/bar?per_page=100").
|
31
31
|
to_return(:status => 200, :body => %q{["stuff"]}, :headers =>
|
32
32
|
{ 'Link' => %q{<https://api.github.com/foo/bar?page=2>; rel="next", <https://api.github.com/foo/bar?page=3>; rel="last"} })
|
@@ -39,10 +39,10 @@ describe Octokit::Client do
|
|
39
39
|
to_return(:status => 200, :body => %q{["stuffapalooza"]}, :headers =>
|
40
40
|
{ 'Link' => %q{<https://api.github.com/foo/bar?page=2>; rel="prev", <https://api.github.com/foo/bar?page=1>; rel="first"} })
|
41
41
|
|
42
|
-
Octokit::Client.new(:auto_traversal => true).get("https://api.github.com/foo/bar", {}, 3).
|
42
|
+
expect(Octokit::Client.new(:auto_traversal => true).get("https://api.github.com/foo/bar", {}, 3)).to eq(['stuff', 'even more stuff', 'stuffapalooza'])
|
43
43
|
end
|
44
44
|
|
45
|
-
it "
|
45
|
+
it "uses the number set in the per_page configuration option when present" do
|
46
46
|
stub_get("https://api.github.com/foo/bar?per_page=50").
|
47
47
|
to_return(:status => 200, :body => %q{["stuff"]}, :headers =>
|
48
48
|
{ 'Link' => %q{<https://api.github.com/foo/bar?page=2>; rel="next", <https://api.github.com/foo/bar?page=3>; rel="last"} })
|
@@ -51,7 +51,7 @@ describe Octokit::Client do
|
|
51
51
|
to_return(:status => 200, :body => %q{["even more stuff"]}, :headers =>
|
52
52
|
{ 'Link' => %q{<https://api.github.com/foo/bar?page=3>; rel="last", <https://api.github.com/foo/bar?page=1>; rel="prev", <https://api.github.com/foo/bar?page=1>; rel="first"} })
|
53
53
|
|
54
|
-
Octokit::Client.new(:auto_traversal => true, :per_page => 50).get("https://api.github.com/foo/bar", {}, 3).
|
54
|
+
expect(Octokit::Client.new(:auto_traversal => true, :per_page => 50).get("https://api.github.com/foo/bar", {}, 3)).to be
|
55
55
|
end
|
56
56
|
|
57
57
|
end
|
@@ -65,12 +65,12 @@ describe Octokit::Client do
|
|
65
65
|
@client = Octokit::Client.new()
|
66
66
|
end
|
67
67
|
|
68
|
-
it "
|
69
|
-
@client.ratelimit.
|
68
|
+
it "gets the ratelimit-limit from the header" do
|
69
|
+
expect(@client.ratelimit).to eq(5000)
|
70
70
|
end
|
71
71
|
|
72
|
-
it "
|
73
|
-
@client.ratelimit_remaining.
|
72
|
+
it "gets the ratelimit-remaining using header" do
|
73
|
+
expect(@client.ratelimit_remaining).to eq(5000)
|
74
74
|
end
|
75
75
|
|
76
76
|
end
|
@@ -91,12 +91,12 @@ describe Octokit::Client do
|
|
91
91
|
Octokit.reset
|
92
92
|
end
|
93
93
|
|
94
|
-
it "
|
95
|
-
@client.ratelimit.
|
94
|
+
it "gets the ratelimit-limit from the header" do
|
95
|
+
expect(@client.ratelimit).to eq(62500)
|
96
96
|
end
|
97
97
|
|
98
|
-
it "
|
99
|
-
@client.ratelimit_remaining.
|
98
|
+
it "gets the ratelimit-remaining using header" do
|
99
|
+
expect(@client.ratelimit_remaining).to eq(62500)
|
100
100
|
end
|
101
101
|
|
102
102
|
end
|
@@ -107,30 +107,30 @@ describe Octokit::Client do
|
|
107
107
|
Octokit.reset
|
108
108
|
end
|
109
109
|
|
110
|
-
it "
|
110
|
+
it "defaults to https://api.github.com" do
|
111
111
|
client = Octokit::Client.new
|
112
|
-
client.api_endpoint.
|
112
|
+
expect(client.api_endpoint).to eq('https://api.github.com/')
|
113
113
|
end
|
114
114
|
|
115
|
-
it "
|
115
|
+
it "is set " do
|
116
116
|
Octokit.api_endpoint = 'http://foo.dev'
|
117
117
|
client = Octokit::Client.new
|
118
|
-
client.api_endpoint.
|
118
|
+
expect(client.api_endpoint).to eq('http://foo.dev/')
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
122
|
describe "request_host" do
|
123
123
|
after(:each) { Octokit.reset }
|
124
124
|
|
125
|
-
it "
|
125
|
+
it "defaults to nil" do
|
126
126
|
client = Octokit::Client.new
|
127
|
-
client.request_host.
|
127
|
+
expect(client.request_host).to be_nil
|
128
128
|
end
|
129
129
|
|
130
|
-
it "
|
130
|
+
it "is settable" do
|
131
131
|
Octokit.request_host = 'github.company.com'
|
132
132
|
client = Octokit::Client.new
|
133
|
-
client.request_host.
|
133
|
+
expect(client.request_host).to eq('github.company.com')
|
134
134
|
end
|
135
135
|
|
136
136
|
it "does not change the Host header when not set" do
|
@@ -139,7 +139,7 @@ describe Octokit::Client do
|
|
139
139
|
stub_request(:any, /.*/)
|
140
140
|
req = stub_request(:get, 'http://github.internal/users/me').with(:headers => { 'Host' => /.*/})
|
141
141
|
Octokit.user "me"
|
142
|
-
req.
|
142
|
+
expect(req).not_to have_been_requested
|
143
143
|
end
|
144
144
|
|
145
145
|
it "changes the Host header when set" do
|
@@ -148,7 +148,7 @@ describe Octokit::Client do
|
|
148
148
|
|
149
149
|
req = stub_request(:get, 'http://github.internal/users/me').with(:headers => { 'Host' => 'github.company.com' })
|
150
150
|
Octokit.user "me"
|
151
|
-
req.
|
151
|
+
expect(req).to have_been_requested
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|