octokit 1.19.0 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/CHANGELOG.md +11 -0
- data/README.md +35 -1
- data/lib/faraday/response/raise_octokit_error.rb +15 -22
- data/lib/octokit.rb +2 -1
- data/lib/octokit/authentication.rb +15 -0
- data/lib/octokit/client.rb +4 -0
- data/lib/octokit/client/authorizations.rb +1 -1
- data/lib/octokit/client/commits.rb +15 -14
- data/lib/octokit/client/contents.rb +42 -42
- data/lib/octokit/client/downloads.rb +5 -1
- data/lib/octokit/client/gists.rb +6 -12
- data/lib/octokit/client/gitignore.rb +41 -0
- data/lib/octokit/client/issues.rb +30 -1
- data/lib/octokit/client/labels.rb +2 -2
- data/lib/octokit/client/milestones.rb +1 -1
- data/lib/octokit/client/notifications.rb +1 -5
- data/lib/octokit/client/organizations.rb +11 -15
- data/lib/octokit/client/pulls.rb +33 -7
- data/lib/octokit/client/refs.rb +1 -1
- data/lib/octokit/client/repositories.rb +27 -40
- data/lib/octokit/client/users.rb +25 -13
- data/lib/octokit/configuration.rb +4 -2
- data/lib/octokit/connection.rb +6 -4
- data/lib/octokit/request.rb +9 -0
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +2 -1
- data/spec/fixtures/.netrc +2 -0
- data/spec/fixtures/all_repositories.json +122 -0
- data/spec/fixtures/all_users.json +34 -0
- data/spec/fixtures/gitignore_template_ruby.json +4 -0
- data/spec/fixtures/gitignore_templates.json +78 -0
- data/spec/fixtures/pull_requests_comments.json +82 -0
- data/spec/fixtures/repository_issues_comments.json +52 -0
- data/spec/octokit/client/authorizations_spec.rb +1 -1
- data/spec/octokit/client/commits_spec.rb +1 -1
- data/spec/octokit/client/downloads_spec.rb +1 -1
- data/spec/octokit/client/gists_spec.rb +6 -6
- data/spec/octokit/client/gitignore_spec.rb +29 -0
- data/spec/octokit/client/issues_spec.rb +12 -1
- data/spec/octokit/client/labels_spec.rb +2 -2
- data/spec/octokit/client/milestones_spec.rb +1 -1
- data/spec/octokit/client/notifications_spec.rb +10 -10
- data/spec/octokit/client/organizations_spec.rb +10 -10
- data/spec/octokit/client/pulls_spec.rb +13 -2
- data/spec/octokit/client/refs_spec.rb +1 -1
- data/spec/octokit/client/repositories_spec.rb +25 -14
- data/spec/octokit/client/users_spec.rb +17 -6
- data/spec/octokit/client_spec.rb +47 -1
- data/spec/octokit_spec.rb +1 -1
- metadata +36 -3
@@ -53,7 +53,7 @@ describe Octokit::Client::Authorizations do
|
|
53
53
|
stub_delete('/authorizations/999999').
|
54
54
|
to_return(:status => 204)
|
55
55
|
result = @client.delete_authorization(999999)
|
56
|
-
expect(result).to
|
56
|
+
expect(result).to eq(true)
|
57
57
|
end
|
58
58
|
|
59
59
|
context "when working with tokens" do
|
@@ -239,7 +239,7 @@ describe Octokit::Client::Commits do
|
|
239
239
|
stub_delete("/repos/sferik/rails_admin/comments/860296").
|
240
240
|
to_return(:status => 204, :body => "")
|
241
241
|
commit_comment = @client.delete_commit_comment("sferik/rails_admin", "860296")
|
242
|
-
expect(commit_comment).to
|
242
|
+
expect(commit_comment).to eq(true)
|
243
243
|
end
|
244
244
|
|
245
245
|
end
|
@@ -56,7 +56,7 @@ describe Octokit::Client::Downloads do
|
|
56
56
|
it "deletes a download" do
|
57
57
|
stub_request(:delete, "https://api.github.com/repos/octocat/Hellow-World/downloads/165347").
|
58
58
|
to_return(:status => 204, :body => "", :headers => {})
|
59
|
-
expect(@client.delete_download('octocat/Hellow-World', 165347)).to
|
59
|
+
expect(@client.delete_download('octocat/Hellow-World', 165347)).to eq(true)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -86,7 +86,7 @@ describe Octokit::Client::Gists do
|
|
86
86
|
it "stars an existing gist" do
|
87
87
|
stub_put("/gists/12345/star").to_return(:status => 204)
|
88
88
|
success = @client.star_gist(12345)
|
89
|
-
expect(success).to
|
89
|
+
expect(success).to eq(true)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -94,7 +94,7 @@ describe Octokit::Client::Gists do
|
|
94
94
|
it "unstars an existing gist" do
|
95
95
|
stub_delete("/gists/12345/star").to_return(:status => 204)
|
96
96
|
success = @client.unstar_gist(12345)
|
97
|
-
expect(success).to
|
97
|
+
expect(success).to eq(true)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -102,7 +102,7 @@ describe Octokit::Client::Gists do
|
|
102
102
|
it "is starred" do
|
103
103
|
stub_get("/gists/12345/star").to_return(:status => 204)
|
104
104
|
starred = @client.gist_starred?(12345)
|
105
|
-
expect(starred).to
|
105
|
+
expect(starred).to eq(true)
|
106
106
|
end
|
107
107
|
|
108
108
|
it "is not starred" do
|
@@ -114,7 +114,7 @@ describe Octokit::Client::Gists do
|
|
114
114
|
|
115
115
|
describe ".fork_gist" do
|
116
116
|
it "forks an existing gist" do
|
117
|
-
stub_post("/gists/12345/
|
117
|
+
stub_post("/gists/12345/forks").
|
118
118
|
to_return(json_response("gist.json"))
|
119
119
|
|
120
120
|
gist = @client.fork_gist(12345)
|
@@ -126,7 +126,7 @@ describe Octokit::Client::Gists do
|
|
126
126
|
it "deletes an existing gist" do
|
127
127
|
stub_delete("/gists/12345").to_return(:status => 204)
|
128
128
|
deleted = @client.delete_gist(12345)
|
129
|
-
expect(deleted).to
|
129
|
+
expect(deleted).to eq(true)
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
@@ -171,7 +171,7 @@ describe Octokit::Client::Gists do
|
|
171
171
|
it "deletes a gist comment" do
|
172
172
|
stub_delete("/gists/4bcad24/comments/12345").to_return(:status => 204)
|
173
173
|
result = @client.delete_gist_comment("4bcad24", 12345)
|
174
|
-
expect(result).to
|
174
|
+
expect(result).to eq(true)
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
describe Octokit::Client::Gitignore do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@client = Octokit::Client.new
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".gitignore_templates" do
|
11
|
+
it "returns all gitignore templates" do
|
12
|
+
stub_get("/gitignore/templates").
|
13
|
+
to_return(json_response("gitignore_templates.json"))
|
14
|
+
templates = @client.gitignore_templates
|
15
|
+
expect(templates.first).to eq("Actionscript")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".gitignore_template" do
|
20
|
+
it "returns the ruby gitignore template" do
|
21
|
+
stub_get("/gitignore/templates/Ruby").
|
22
|
+
to_return(json_response("gitignore_template_ruby.json"))
|
23
|
+
template = @client.gitignore_template("Ruby")
|
24
|
+
expect(template.name).to eq("Ruby")
|
25
|
+
expect(template.source).to include("*.gem\n")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -113,6 +113,17 @@ describe Octokit::Client::Issues do
|
|
113
113
|
|
114
114
|
end
|
115
115
|
|
116
|
+
describe ".repository_issues_comments" do
|
117
|
+
|
118
|
+
it "returns comments for all issues in a repository" do
|
119
|
+
stub_get("/repos/pengwynn/octokit/issues/comments").
|
120
|
+
to_return(json_response('repository_issues_comments.json'))
|
121
|
+
comments = @client.issues_comments("pengwynn/octokit")
|
122
|
+
expect(comments.first.user.login).to eq("pengwynn")
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
116
127
|
describe ".issue_comments" do
|
117
128
|
|
118
129
|
it "returns comments for an issue" do
|
@@ -166,7 +177,7 @@ describe Octokit::Client::Issues do
|
|
166
177
|
stub_delete("/repos/pengwynn/octokit/issues/comments/1194549").
|
167
178
|
to_return(:status => 204)
|
168
179
|
result = @client.delete_comment("pengwynn/octokit", 1194549)
|
169
|
-
expect(result).to
|
180
|
+
expect(result).to eq(true)
|
170
181
|
end
|
171
182
|
|
172
183
|
end
|
@@ -72,7 +72,7 @@ describe Octokit::Client::Labels do
|
|
72
72
|
to_return(:status => 204)
|
73
73
|
|
74
74
|
result = @client.delete_label!("pengwynn/octokit", "V3 Transition")
|
75
|
-
expect(result).to
|
75
|
+
expect(result).to eq(true)
|
76
76
|
end
|
77
77
|
|
78
78
|
end
|
@@ -96,7 +96,7 @@ describe Octokit::Client::Labels do
|
|
96
96
|
to_return(:status => 204)
|
97
97
|
|
98
98
|
result = @client.remove_all_labels('pengwynn/octokit', 23)
|
99
|
-
expect(result).to
|
99
|
+
expect(result).to eq(true)
|
100
100
|
end
|
101
101
|
|
102
102
|
end
|
@@ -59,7 +59,7 @@ describe Octokit::Client::Milestones do
|
|
59
59
|
stub_delete("/repos/pengwynn/octokit/milestones/2").
|
60
60
|
to_return(:status => 204, :body => "", :headers => {})
|
61
61
|
result = @client.delete_milestone("pengwynn/octokit", 2)
|
62
|
-
expect(result).to
|
62
|
+
expect(result).to eq(true)
|
63
63
|
end
|
64
64
|
|
65
65
|
end
|
@@ -14,7 +14,7 @@ describe Octokit::Client::Notifications do
|
|
14
14
|
to_return(json_response("notifications.json"))
|
15
15
|
notifications = @client.notifications
|
16
16
|
expect(notifications.first.id).to eq(1)
|
17
|
-
expect(notifications.first.unread).to
|
17
|
+
expect(notifications.first.unread).to eq(true)
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -26,7 +26,7 @@ describe Octokit::Client::Notifications do
|
|
26
26
|
to_return(json_response("repository_notifications.json"))
|
27
27
|
notifications = @client.repository_notifications("pengwynn/octokit")
|
28
28
|
expect(notifications.first.id).to eq(1)
|
29
|
-
expect(notifications.first.unread).to
|
29
|
+
expect(notifications.first.unread).to eq(true)
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -37,7 +37,7 @@ describe Octokit::Client::Notifications do
|
|
37
37
|
stub_put("https://api.github.com/notifications").
|
38
38
|
to_return(:status => 205)
|
39
39
|
result = @client.mark_notifications_as_read
|
40
|
-
expect(result).to
|
40
|
+
expect(result).to eq(true)
|
41
41
|
end
|
42
42
|
|
43
43
|
it "returns false when unsuccessful" do
|
@@ -55,7 +55,7 @@ describe Octokit::Client::Notifications do
|
|
55
55
|
stub_put("https://api.github.com/repos/pengwynn/octokit/notifications").
|
56
56
|
to_return(:status => 205)
|
57
57
|
result = @client.mark_repository_notifications_as_read("pengwynn/octokit")
|
58
|
-
expect(result).to
|
58
|
+
expect(result).to eq(true)
|
59
59
|
end
|
60
60
|
|
61
61
|
it "returns false when unsuccessful" do
|
@@ -74,7 +74,7 @@ describe Octokit::Client::Notifications do
|
|
74
74
|
to_return(json_response('notification_thread.json'))
|
75
75
|
notifications = @client.thread_notifications(1)
|
76
76
|
expect(notifications.first.id).to eq(1)
|
77
|
-
expect(notifications.first.unread).to
|
77
|
+
expect(notifications.first.unread).to eq(true)
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
@@ -85,7 +85,7 @@ describe Octokit::Client::Notifications do
|
|
85
85
|
stub_patch("https://api.github.com/notifications/threads/1").
|
86
86
|
to_return(:status => 205)
|
87
87
|
result = @client.mark_thread_as_read(1)
|
88
|
-
expect(result).to
|
88
|
+
expect(result).to eq(true)
|
89
89
|
end
|
90
90
|
|
91
91
|
it "returns false when unsuccessful" do
|
@@ -103,7 +103,7 @@ describe Octokit::Client::Notifications do
|
|
103
103
|
stub_get("https://api.github.com/notifications/threads/1/subscription").
|
104
104
|
to_return(json_response("thread_subscription.json"))
|
105
105
|
subscription = @client.thread_subscription(1)
|
106
|
-
expect(subscription.subscribed).to
|
106
|
+
expect(subscription.subscribed).to eq(true)
|
107
107
|
end
|
108
108
|
|
109
109
|
end
|
@@ -114,7 +114,7 @@ describe Octokit::Client::Notifications do
|
|
114
114
|
stub_put("https://api.github.com/notifications/threads/1/subscription").
|
115
115
|
to_return(json_response("thread_subscription_update.json"))
|
116
116
|
subscription = @client.update_thread_subscription(1, :subscribed => true)
|
117
|
-
expect(subscription.subscribed).to
|
117
|
+
expect(subscription.subscribed).to eq(true)
|
118
118
|
end
|
119
119
|
|
120
120
|
end
|
@@ -125,12 +125,12 @@ describe Octokit::Client::Notifications do
|
|
125
125
|
stub_delete("https://api.github.com/notifications/threads/1").
|
126
126
|
to_return(:status => 204)
|
127
127
|
result = @client.delete_thread_subscription(1)
|
128
|
-
expect(result).to
|
128
|
+
expect(result).to eq(true)
|
129
129
|
end
|
130
130
|
|
131
131
|
it "returns false when subscription deletion fails" do
|
132
132
|
stub_delete("https://api.github.com/notifications/threads/1").
|
133
|
-
to_return(:status =>
|
133
|
+
to_return(:status => 404)
|
134
134
|
result = @client.delete_thread_subscription(1)
|
135
135
|
expect(result).to be_false
|
136
136
|
end
|
@@ -86,7 +86,7 @@ describe Octokit::Client::Organizations do
|
|
86
86
|
stub_get("https://api.github.com/orgs/github/members/pengwynn").
|
87
87
|
to_return(:status => 204)
|
88
88
|
is_hubbernaut = @client.organization_member?('github', 'pengwynn')
|
89
|
-
expect(is_hubbernaut).to
|
89
|
+
expect(is_hubbernaut).to eq(true)
|
90
90
|
end
|
91
91
|
|
92
92
|
end
|
@@ -112,7 +112,7 @@ describe Octokit::Client::Organizations do
|
|
112
112
|
stub_get("https://api.github.com/orgs/github/public_members/pengwynn").
|
113
113
|
to_return(:status => 204)
|
114
114
|
is_hubbernaut = @client.organization_public_member?('github', 'pengwynn')
|
115
|
-
expect(is_hubbernaut).to
|
115
|
+
expect(is_hubbernaut).to eq(true)
|
116
116
|
end
|
117
117
|
|
118
118
|
end
|
@@ -182,7 +182,7 @@ describe Octokit::Client::Organizations do
|
|
182
182
|
stub_delete("https://api.github.com/teams/32598").
|
183
183
|
to_return(:status => 204)
|
184
184
|
result = @client.delete_team(32598)
|
185
|
-
expect(result).to
|
185
|
+
expect(result).to eq(true)
|
186
186
|
end
|
187
187
|
|
188
188
|
end
|
@@ -206,7 +206,7 @@ describe Octokit::Client::Organizations do
|
|
206
206
|
with(:name => "sferik").
|
207
207
|
to_return(:status => 204)
|
208
208
|
result = @client.add_team_member(32598, "sferik")
|
209
|
-
expect(result).to
|
209
|
+
expect(result).to eq(true)
|
210
210
|
end
|
211
211
|
|
212
212
|
end
|
@@ -217,7 +217,7 @@ describe Octokit::Client::Organizations do
|
|
217
217
|
stub_delete("https://api.github.com/teams/32598/members/sferik").
|
218
218
|
to_return(:status => 204)
|
219
219
|
result = @client.remove_team_member(32598, "sferik")
|
220
|
-
expect(result).to
|
220
|
+
expect(result).to eq(true)
|
221
221
|
end
|
222
222
|
|
223
223
|
end
|
@@ -227,7 +227,7 @@ describe Octokit::Client::Organizations do
|
|
227
227
|
stub_delete("https://api.github.com/orgs/codeforamerica/members/glow-mdsol").
|
228
228
|
to_return(:status => 204)
|
229
229
|
result = @client.remove_organization_member("codeforamerica", "glow-mdsol")
|
230
|
-
expect(result).to
|
230
|
+
expect(result).to eq(true)
|
231
231
|
end
|
232
232
|
|
233
233
|
end
|
@@ -250,7 +250,7 @@ describe Octokit::Client::Organizations do
|
|
250
250
|
with(:name => "reddavis/One40Proof").
|
251
251
|
to_return(:status => 204)
|
252
252
|
result = @client.add_team_repository(32598, "reddavis/One40Proof")
|
253
|
-
expect(result).to
|
253
|
+
expect(result).to eq(true)
|
254
254
|
end
|
255
255
|
|
256
256
|
end
|
@@ -261,7 +261,7 @@ describe Octokit::Client::Organizations do
|
|
261
261
|
stub_delete("https://api.github.com/teams/32598/repos/reddavis/One40Proof").
|
262
262
|
to_return(:status => 204)
|
263
263
|
result = @client.remove_team_repository(32598, "reddavis/One40Proof")
|
264
|
-
expect(result).to
|
264
|
+
expect(result).to eq(true)
|
265
265
|
end
|
266
266
|
|
267
267
|
end
|
@@ -273,7 +273,7 @@ describe Octokit::Client::Organizations do
|
|
273
273
|
with(:name => "sferik").
|
274
274
|
to_return(:status => 204)
|
275
275
|
result = @client.publicize_membership("codeforamerica", "sferik")
|
276
|
-
expect(result).to
|
276
|
+
expect(result).to eq(true)
|
277
277
|
end
|
278
278
|
|
279
279
|
end
|
@@ -285,7 +285,7 @@ describe Octokit::Client::Organizations do
|
|
285
285
|
with(:name => "sferik").
|
286
286
|
to_return(:status => 204)
|
287
287
|
result = @client.unpublicize_membership("codeforamerica", "sferik")
|
288
|
-
expect(result).to
|
288
|
+
expect(result).to eq(true)
|
289
289
|
end
|
290
290
|
|
291
291
|
end
|
@@ -57,6 +57,17 @@ describe Octokit::Client::Pulls do
|
|
57
57
|
|
58
58
|
end
|
59
59
|
|
60
|
+
describe ".pull_requests_comments" do
|
61
|
+
|
62
|
+
it "returns all comments on all pull requests" do
|
63
|
+
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/comments").
|
64
|
+
to_return(json_response("pull_requests_comments.json"))
|
65
|
+
comments = @client.pull_requests_comments("pengwynn/octokit")
|
66
|
+
expect(comments.first.user.login).to eq("sferik")
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
60
71
|
describe ".pull_request" do
|
61
72
|
|
62
73
|
it "returns a pull request" do
|
@@ -156,7 +167,7 @@ describe Octokit::Client::Pulls do
|
|
156
167
|
stub_delete("https://api.github.com/repos/pengwynn/octokit/pulls/comments/1907270").
|
157
168
|
to_return(:status => 204)
|
158
169
|
result = @client.delete_pull_request_comment("pengwynn/octokit", 1907270)
|
159
|
-
expect(result).to
|
170
|
+
expect(result).to eq(true)
|
160
171
|
end
|
161
172
|
|
162
173
|
end
|
@@ -192,7 +203,7 @@ describe Octokit::Client::Pulls do
|
|
192
203
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67/merge").
|
193
204
|
to_return(:status => 204)
|
194
205
|
merged = @client.pull_merged?("pengwynn/octokit", 67)
|
195
|
-
expect(merged).to
|
206
|
+
expect(merged).to eq(true)
|
196
207
|
end
|
197
208
|
end
|
198
209
|
|
@@ -70,7 +70,7 @@ describe Octokit::Client::Refs do
|
|
70
70
|
stub_delete("/repos/octocat/Hello-World/git/refs/heads/feature-a").
|
71
71
|
to_return(:status => 204)
|
72
72
|
result = @client.delete_ref("octocat/Hello-World", "heads/feature-a")
|
73
|
-
expect(result).to
|
73
|
+
expect(result).to eq(true)
|
74
74
|
end
|
75
75
|
|
76
76
|
end
|
@@ -68,12 +68,23 @@ describe Octokit::Client::Repositories do
|
|
68
68
|
|
69
69
|
end
|
70
70
|
|
71
|
+
describe ".all_repositories" do
|
72
|
+
|
73
|
+
it "returns all repositories on github" do
|
74
|
+
stub_get("/repositories").
|
75
|
+
to_return(json_response("all_repositories.json"))
|
76
|
+
repositories = @client.all_repositories
|
77
|
+
expect(repositories.first.name).to eq("grit")
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
71
82
|
describe ".star" do
|
72
83
|
|
73
84
|
it "stars a repository" do
|
74
85
|
stub_put("/user/starred/sferik/rails_admin").
|
75
86
|
to_return(:status => 204)
|
76
|
-
expect(@client.star("sferik/rails_admin")).to
|
87
|
+
expect(@client.star("sferik/rails_admin")).to eq(true)
|
77
88
|
end
|
78
89
|
|
79
90
|
end
|
@@ -83,7 +94,7 @@ describe Octokit::Client::Repositories do
|
|
83
94
|
it "unstars a repository" do
|
84
95
|
stub_delete("/user/starred/sferik/rails_admin").
|
85
96
|
to_return(:status => 204)
|
86
|
-
expect(@client.unstar("sferik/rails_admin")).to
|
97
|
+
expect(@client.unstar("sferik/rails_admin")).to eq(true)
|
87
98
|
end
|
88
99
|
|
89
100
|
end
|
@@ -93,7 +104,7 @@ describe Octokit::Client::Repositories do
|
|
93
104
|
it "watches a repository" do
|
94
105
|
stub_put("/user/watched/sferik/rails_admin").
|
95
106
|
to_return(:status => 204)
|
96
|
-
expect(@client.watch("sferik/rails_admin")).to
|
107
|
+
expect(@client.watch("sferik/rails_admin")).to eq(true)
|
97
108
|
end
|
98
109
|
|
99
110
|
end
|
@@ -103,7 +114,7 @@ describe Octokit::Client::Repositories do
|
|
103
114
|
it "unwatches a repository" do
|
104
115
|
stub_delete("/user/watched/sferik/rails_admin").
|
105
116
|
to_return(:status => 204)
|
106
|
-
expect(@client.unwatch("sferik/rails_admin")).to
|
117
|
+
expect(@client.unwatch("sferik/rails_admin")).to eq(true)
|
107
118
|
end
|
108
119
|
|
109
120
|
end
|
@@ -146,7 +157,7 @@ describe Octokit::Client::Repositories do
|
|
146
157
|
stub_delete("/repos/sferik/rails_admin").
|
147
158
|
to_return(:status => 204, :body => "")
|
148
159
|
result = @client.delete_repository("sferik/rails_admin")
|
149
|
-
expect(result).to
|
160
|
+
expect(result).to eq(true)
|
150
161
|
end
|
151
162
|
|
152
163
|
end
|
@@ -205,7 +216,7 @@ describe Octokit::Client::Repositories do
|
|
205
216
|
stub_delete("/repos/sferik/rails_admin/keys/#{103205}").
|
206
217
|
to_return(:status => 204)
|
207
218
|
result = @client.remove_deploy_key("sferik/rails_admin", 103205)
|
208
|
-
expect(result).to
|
219
|
+
expect(result).to eq(true)
|
209
220
|
end
|
210
221
|
|
211
222
|
end
|
@@ -227,7 +238,7 @@ describe Octokit::Client::Repositories do
|
|
227
238
|
stub_put("/repos/sferik/rails_admin/collaborators/sferik").
|
228
239
|
to_return(:status => 204)
|
229
240
|
result = @client.add_collaborator("sferik/rails_admin", "sferik")
|
230
|
-
expect(result).to
|
241
|
+
expect(result).to eq(true)
|
231
242
|
end
|
232
243
|
|
233
244
|
end
|
@@ -238,7 +249,7 @@ describe Octokit::Client::Repositories do
|
|
238
249
|
stub_delete("/repos/sferik/rails_admin/collaborators/sferik").
|
239
250
|
to_return(:status => 204)
|
240
251
|
result = @client.remove_collaborator("sferik/rails_admin", "sferik")
|
241
|
-
expect(result).to
|
252
|
+
expect(result).to eq(true)
|
242
253
|
end
|
243
254
|
|
244
255
|
end
|
@@ -409,7 +420,7 @@ describe Octokit::Client::Repositories do
|
|
409
420
|
it "removes a hook" do
|
410
421
|
stub_delete("/repos/railsbp/railsbp.com/hooks/154284").
|
411
422
|
to_return(:status => 204)
|
412
|
-
expect(@client.remove_hook("railsbp/railsbp.com", 154284)).to
|
423
|
+
expect(@client.remove_hook("railsbp/railsbp.com", 154284)).to eq(true)
|
413
424
|
end
|
414
425
|
|
415
426
|
end
|
@@ -417,9 +428,9 @@ describe Octokit::Client::Repositories do
|
|
417
428
|
describe ".test_hook" do
|
418
429
|
|
419
430
|
it "tests a hook" do
|
420
|
-
stub_post("/repos/railsbp/railsbp.com/hooks/154284/
|
431
|
+
stub_post("/repos/railsbp/railsbp.com/hooks/154284/tests").
|
421
432
|
to_return(:status => 204)
|
422
|
-
expect(@client.test_hook("railsbp/railsbp.com", 154284)).to
|
433
|
+
expect(@client.test_hook("railsbp/railsbp.com", 154284)).to eq(true)
|
423
434
|
end
|
424
435
|
|
425
436
|
end
|
@@ -465,7 +476,7 @@ describe Octokit::Client::Repositories do
|
|
465
476
|
stub_get("/repos/pengwynn/octokit/subscription").
|
466
477
|
to_return(json_response("subscription.json"))
|
467
478
|
subscription = @client.subscription("pengwynn/octokit")
|
468
|
-
expect(subscription.subscribed).to
|
479
|
+
expect(subscription.subscribed).to eq(true)
|
469
480
|
end
|
470
481
|
|
471
482
|
end
|
@@ -487,12 +498,12 @@ describe Octokit::Client::Repositories do
|
|
487
498
|
stub_delete("/repos/pengwynn/octokit/subscription").
|
488
499
|
to_return(:status => 204)
|
489
500
|
result = @client.delete_subscription("pengwynn/octokit")
|
490
|
-
expect(result).to
|
501
|
+
expect(result).to eq(true)
|
491
502
|
end
|
492
503
|
|
493
504
|
it "returns false when delete repo subscription fails" do
|
494
505
|
stub_delete("/repos/pengwynn/octokit/subscription").
|
495
|
-
to_return(:status =>
|
506
|
+
to_return(:status => 404)
|
496
507
|
result = @client.delete_subscription("pengwynn/octokit")
|
497
508
|
expect(result).to be_false
|
498
509
|
end
|