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
@@ -9,13 +9,13 @@ describe Octokit::Client::Markdown do
|
|
9
9
|
@client = Octokit::Client.new
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "renders markdown" do
|
13
13
|
stub_post("/markdown").
|
14
14
|
to_return(:body => fixture("v3/markdown_gfm"))
|
15
15
|
text = "This is for #111"
|
16
16
|
markdown = @client.markdown(text, :context => 'pengwynn/octokit', :mode => 'gfm')
|
17
17
|
|
18
|
-
markdown.
|
18
|
+
expect(markdown).to include('https://github.com/pengwynn/octokit/issues/111')
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
@@ -9,57 +9,57 @@ describe Octokit::Client::Milestones do
|
|
9
9
|
|
10
10
|
describe ".list_milestones" do
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "lists milestones belonging to repository" do
|
13
13
|
stub_get("/repos/pengwynn/octokit/milestones").
|
14
14
|
to_return(:status => 200, :body => fixture('v3/milestones.json'))
|
15
15
|
milestones = @client.list_milestones("pengwynn/octokit")
|
16
|
-
milestones.first.description.
|
16
|
+
expect(milestones.first.description).to eq("Add support for API v3")
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe ".milestone" do
|
22
22
|
|
23
|
-
it "
|
23
|
+
it "gets a single milestone belonging to repository" do
|
24
24
|
stub_get("/repos/pengwynn/octokit/milestones/1").
|
25
25
|
to_return(:status => 200, :body => fixture('v3/milestone.json'))
|
26
26
|
milestones = @client.milestone("pengwynn/octokit", 1)
|
27
|
-
milestones.description.
|
27
|
+
expect(milestones.description).to eq("Add support for API v3")
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
31
31
|
|
32
32
|
describe ".create_milestone" do
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "creates a single milestone" do
|
35
35
|
stub_post("/repos/pengwynn/octokit/milestones").
|
36
36
|
with(:body => '{"title":"0.7.0"}', :headers => {'Content-Type'=>'application/json'}).
|
37
37
|
to_return(:status => 201, :body => fixture('v3/milestone.json'))
|
38
38
|
milestone = @client.create_milestone("pengwynn/octokit", "0.7.0")
|
39
|
-
milestone.title.
|
39
|
+
expect(milestone.title).to eq("0.7.0")
|
40
40
|
end
|
41
41
|
|
42
42
|
end
|
43
43
|
|
44
44
|
describe ".update_milestone" do
|
45
45
|
|
46
|
-
it "
|
46
|
+
it "updates a milestone" do
|
47
47
|
stub_post("/repos/pengwynn/octokit/milestones/1").
|
48
48
|
with(:body => {"description" => "Add support for API v3"}, :headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json'}).
|
49
49
|
to_return(:status => 200, :body => fixture('v3/milestone.json'))
|
50
50
|
milestone = @client.update_milestone("pengwynn/octokit", 1, {:description => "Add support for API v3"})
|
51
|
-
milestone.description.
|
51
|
+
expect(milestone.description).to eq("Add support for API v3")
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
55
55
|
|
56
56
|
describe ".delete_milestone" do
|
57
57
|
|
58
|
-
it "
|
58
|
+
it "deletes a milestone from a repository" do
|
59
59
|
stub_delete("/repos/pengwynn/octokit/milestones/2").
|
60
60
|
to_return(:status => 204, :body => "", :headers => {})
|
61
61
|
response = @client.delete_milestone("pengwynn/octokit", 2)
|
62
|
-
response.status.
|
62
|
+
expect(response.status).to eq(204)
|
63
63
|
end
|
64
64
|
|
65
65
|
end
|
@@ -9,51 +9,51 @@ describe Octokit::Client::Objects do
|
|
9
9
|
|
10
10
|
describe ".tree" do
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "returns a tree" do
|
13
13
|
stub_get("https://api.github.com/repos/sferik/rails_admin/git/trees/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
|
14
14
|
to_return(:body => fixture("v3/tree.json"))
|
15
15
|
result = @client.tree("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
16
|
-
result.sha.
|
17
|
-
result.tree.first.path.
|
16
|
+
expect(result.sha).to eq("3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
|
17
|
+
expect(result.tree.first.path).to eq(".gitignore")
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
21
21
|
|
22
22
|
describe ".create_tree" do
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "creates a tree" do
|
25
25
|
stub_post("/repos/octocat/Hello-World/git/trees").
|
26
26
|
with(:body => { :tree => [ { :path => "file.rb", "mode" => "100644", "type" => "blob", "sha" => "44b4fc6d56897b048c772eb4087f854f46256132" } ] },
|
27
27
|
:headers => { "Content-Type" => "application/json" }).
|
28
28
|
to_return(:body => fixture("v3/tree_create.json"))
|
29
29
|
response = @client.create_tree("octocat/Hello-World", [ { "path" => "file.rb", "mode" => "100644", "type" => "blob", "sha" => "44b4fc6d56897b048c772eb4087f854f46256132" } ])
|
30
|
-
response.sha.
|
31
|
-
response.tree.size.
|
32
|
-
response.tree.first.sha.
|
30
|
+
expect(response.sha).to eq("cd8274d15fa3ae2ab983129fb037999f264ba9a7")
|
31
|
+
expect(response.tree.size).to eq(1)
|
32
|
+
expect(response.tree.first.sha).to eq("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b")
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe ".blob" do
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "returns a blob" do
|
40
40
|
stub_get("https://api.github.com/repos/sferik/rails_admin/git/blobs/94616fa57520ac8147522c7cf9f03d555595c5ea").
|
41
41
|
to_return(:body => fixture("v3/blob.json"))
|
42
42
|
blob = @client.blob("sferik/rails_admin", "94616fa57520ac8147522c7cf9f03d555595c5ea")
|
43
|
-
blob.sha.
|
43
|
+
expect(blob.sha).to eq("94616fa57520ac8147522c7cf9f03d555595c5ea")
|
44
44
|
end
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
48
|
describe ".create_blob" do
|
49
49
|
|
50
|
-
it "
|
50
|
+
it "creates a blob" do
|
51
51
|
stub_post("/repos/octocat/Hello-World/git/blobs").
|
52
52
|
with(:body => { :content => "content", :encoding => "utf-8" },
|
53
53
|
:headers => { "Content-Type" => "application/json" }).
|
54
54
|
to_return(:body => fixture("v3/blob_create.json"))
|
55
55
|
blob = @client.create_blob("octocat/Hello-World", "content")
|
56
|
-
blob.
|
56
|
+
expect(blob).to eq("3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15")
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
@@ -9,23 +9,23 @@ describe Octokit::Client::Organizations do
|
|
9
9
|
|
10
10
|
describe ".organization" do
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "returns an organization" do
|
13
13
|
stub_get("https://api.github.com/orgs/codeforamerica").
|
14
14
|
to_return(:body => fixture("v3/organization.json"))
|
15
15
|
organization = @client.organization("codeforamerica")
|
16
|
-
organization.name.
|
16
|
+
expect(organization.name).to eq("Code For America")
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe ".update_organization" do
|
22
22
|
|
23
|
-
it "
|
23
|
+
it "updates an organization" do
|
24
24
|
stub_patch("https://api.github.com/orgs/codeforamerica").
|
25
25
|
with(:name => "Code For America").
|
26
26
|
to_return(:body => fixture("v3/organization.json"))
|
27
27
|
organization = @client.update_organization("codeforamerica", {:name => "Code For America"})
|
28
|
-
organization.name.
|
28
|
+
expect(organization.name).to eq("Code For America")
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
@@ -34,22 +34,22 @@ describe Octokit::Client::Organizations do
|
|
34
34
|
|
35
35
|
context "with a user passed" do
|
36
36
|
|
37
|
-
it "
|
37
|
+
it "returns all organizations for a user" do
|
38
38
|
stub_get("https://api.github.com/users/sferik/orgs").
|
39
39
|
to_return(:body => fixture("v3/organizations.json"))
|
40
40
|
organizations = @client.organizations("sferik")
|
41
|
-
organizations.first.login.
|
41
|
+
expect(organizations.first.login).to eq("Hubcap")
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
46
|
context "without user passed" do
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "returns all organizations for a user" do
|
49
49
|
stub_get("https://api.github.com/user/orgs").
|
50
50
|
to_return(:body => fixture("v3/organizations.json"))
|
51
51
|
organizations = @client.organizations
|
52
|
-
organizations.first.login.
|
52
|
+
expect(organizations.first.login).to eq("Hubcap")
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
@@ -58,79 +58,79 @@ describe Octokit::Client::Organizations do
|
|
58
58
|
|
59
59
|
describe ".organization_repositories" do
|
60
60
|
|
61
|
-
it "
|
61
|
+
it "returns all public repositories for an organization" do
|
62
62
|
stub_get("https://api.github.com/orgs/codeforamerica/repos").
|
63
63
|
to_return(:body => fixture("v3/organization-repositories.json"))
|
64
64
|
repositories = @client.organization_repositories("codeforamerica")
|
65
|
-
repositories.first.name.
|
65
|
+
expect(repositories.first.name).to eq("cfahelloworld")
|
66
66
|
end
|
67
67
|
|
68
68
|
end
|
69
69
|
|
70
70
|
describe ".organization_members" do
|
71
71
|
|
72
|
-
it "
|
72
|
+
it "returns all public members of an organization" do
|
73
73
|
stub_get("https://api.github.com/orgs/codeforamerica/members").
|
74
74
|
to_return(:body => fixture("v3/organization_members.json"))
|
75
75
|
users = @client.organization_members("codeforamerica")
|
76
|
-
users.first.login.
|
76
|
+
expect(users.first.login).to eq("akit")
|
77
77
|
end
|
78
78
|
|
79
79
|
end
|
80
80
|
|
81
81
|
describe ".organization_teams" do
|
82
82
|
|
83
|
-
it "
|
83
|
+
it "returns all teams for an organization" do
|
84
84
|
stub_get("https://api.github.com/orgs/codeforamerica/teams").
|
85
85
|
to_return(:body => fixture("v3/teams.json"))
|
86
86
|
teams = @client.organization_teams("codeforamerica")
|
87
|
-
teams.first.name.
|
87
|
+
expect(teams.first.name).to eq("Fellows")
|
88
88
|
end
|
89
89
|
|
90
90
|
end
|
91
91
|
|
92
92
|
describe ".create_team" do
|
93
93
|
|
94
|
-
it "
|
94
|
+
it "creates a team" do
|
95
95
|
stub_post("https://api.github.com/orgs/codeforamerica/teams").
|
96
96
|
with(:name => "Fellows").
|
97
97
|
to_return(:body => fixture("v3/team.json"))
|
98
98
|
team = @client.create_team("codeforamerica", {:name => "Fellows"})
|
99
|
-
team.name.
|
99
|
+
expect(team.name).to eq("Fellows")
|
100
100
|
end
|
101
101
|
|
102
102
|
end
|
103
103
|
|
104
104
|
describe ".team" do
|
105
105
|
|
106
|
-
it "
|
106
|
+
it "returns a team" do
|
107
107
|
stub_get("https://api.github.com/teams/32598").
|
108
108
|
to_return(:body => fixture("v3/team.json"))
|
109
109
|
team = @client.team(32598)
|
110
|
-
team.name.
|
110
|
+
expect(team.name).to eq("Fellows")
|
111
111
|
end
|
112
112
|
|
113
113
|
end
|
114
114
|
|
115
115
|
describe ".update_team" do
|
116
116
|
|
117
|
-
it "
|
117
|
+
it "updates a team" do
|
118
118
|
stub_patch("https://api.github.com/teams/32598").
|
119
119
|
with(:name => "Fellows").
|
120
120
|
to_return(:body => fixture("v3/team.json"))
|
121
121
|
team = @client.update_team(32598, :name => "Fellows")
|
122
|
-
team.name.
|
122
|
+
expect(team.name).to eq("Fellows")
|
123
123
|
end
|
124
124
|
|
125
125
|
end
|
126
126
|
|
127
127
|
describe ".delete_team" do
|
128
128
|
|
129
|
-
it "
|
129
|
+
it "deletes a team" do
|
130
130
|
stub_delete("https://api.github.com/teams/32598").
|
131
131
|
to_return(:status => 204)
|
132
132
|
result = @client.delete_team(32598)
|
133
|
-
result.status.
|
133
|
+
expect(result.status).to eq(204)
|
134
134
|
end
|
135
135
|
|
136
136
|
end
|
@@ -138,102 +138,102 @@ describe Octokit::Client::Organizations do
|
|
138
138
|
|
139
139
|
describe ".team_members" do
|
140
140
|
|
141
|
-
it "
|
141
|
+
it "returns team members" do
|
142
142
|
stub_get("https://api.github.com/teams/33239/members").
|
143
143
|
to_return(:body => fixture("v3/organization_team_members.json"))
|
144
144
|
users = @client.team_members(33239)
|
145
|
-
users.first.login.
|
145
|
+
expect(users.first.login).to eq("ctshryock")
|
146
146
|
end
|
147
147
|
|
148
148
|
end
|
149
149
|
|
150
150
|
describe ".add_team_member" do
|
151
151
|
|
152
|
-
it "
|
152
|
+
it "adds a team member" do
|
153
153
|
stub_put("https://api.github.com/teams/32598/members/sferik").
|
154
154
|
with(:name => "sferik").
|
155
155
|
to_return(:status => 204)
|
156
156
|
result = @client.add_team_member(32598, "sferik")
|
157
|
-
result.
|
157
|
+
expect(result).to be_true
|
158
158
|
end
|
159
159
|
|
160
160
|
end
|
161
161
|
|
162
162
|
describe ".remove_team_member" do
|
163
163
|
|
164
|
-
it "
|
164
|
+
it "removes a team member" do
|
165
165
|
stub_delete("https://api.github.com/teams/32598/members/sferik").
|
166
166
|
to_return(:status => 204)
|
167
167
|
result = @client.remove_team_member(32598, "sferik")
|
168
|
-
result.
|
168
|
+
expect(result).to be_true
|
169
169
|
end
|
170
170
|
|
171
171
|
end
|
172
172
|
|
173
173
|
describe ".remove_organization_member" do
|
174
|
-
it "
|
174
|
+
it "removes a member from an organization" do
|
175
175
|
stub_delete("https://api.github.com/orgs/codeforamerica/members/glow-mdsol").
|
176
176
|
to_return(:status => 204)
|
177
177
|
result = @client.remove_organization_member("codeforamerica", "glow-mdsol")
|
178
|
-
result.
|
178
|
+
expect(result).to be_true
|
179
179
|
end
|
180
180
|
|
181
181
|
end
|
182
182
|
describe ".team_repositories" do
|
183
183
|
|
184
|
-
it "
|
184
|
+
it "returns team repositories" do
|
185
185
|
stub_get("https://api.github.com/teams/33239/repos").
|
186
186
|
to_return(:body => fixture("v3/organization_team_repos.json"))
|
187
187
|
repositories = @client.team_repositories(33239)
|
188
|
-
repositories.first.name.
|
189
|
-
repositories.first.owner.id.
|
188
|
+
expect(repositories.first.name).to eq("GitTalk")
|
189
|
+
expect(repositories.first.owner.id).to eq(570695)
|
190
190
|
end
|
191
191
|
|
192
192
|
end
|
193
193
|
|
194
194
|
describe ".add_team_repository" do
|
195
195
|
|
196
|
-
it "
|
196
|
+
it "adds a team repository" do
|
197
197
|
stub_put("https://api.github.com/teams/32598/repos/reddavis/One40Proof").
|
198
198
|
with(:name => "reddavis/One40Proof").
|
199
199
|
to_return(:status => 204)
|
200
200
|
result = @client.add_team_repository(32598, "reddavis/One40Proof")
|
201
|
-
result.
|
201
|
+
expect(result).to be_true
|
202
202
|
end
|
203
203
|
|
204
204
|
end
|
205
205
|
|
206
206
|
describe ".remove_team_repository" do
|
207
207
|
|
208
|
-
it "
|
208
|
+
it "removes a team repository" do
|
209
209
|
stub_delete("https://api.github.com/teams/32598/repos/reddavis/One40Proof").
|
210
210
|
to_return(:status => 204)
|
211
211
|
result = @client.remove_team_repository(32598, "reddavis/One40Proof")
|
212
|
-
result.
|
212
|
+
expect(result).to be_true
|
213
213
|
end
|
214
214
|
|
215
215
|
end
|
216
216
|
|
217
217
|
describe ".publicize_membership" do
|
218
218
|
|
219
|
-
it "
|
219
|
+
it "pulicizes membership" do
|
220
220
|
stub_put("https://api.github.com/orgs/codeforamerica/public_members/sferik").
|
221
221
|
with(:name => "sferik").
|
222
222
|
to_return(:status => 204)
|
223
223
|
result = @client.publicize_membership("codeforamerica", "sferik")
|
224
|
-
result.
|
224
|
+
expect(result).to be_true
|
225
225
|
end
|
226
226
|
|
227
227
|
end
|
228
228
|
|
229
229
|
describe ".unpublicize_membership" do
|
230
230
|
|
231
|
-
it "
|
231
|
+
it "unpulicizes membership" do
|
232
232
|
stub_delete("https://api.github.com/orgs/codeforamerica/public_members/sferik").
|
233
233
|
with(:name => "sferik").
|
234
234
|
to_return(:status => 204)
|
235
235
|
result = @client.unpublicize_membership("codeforamerica", "sferik")
|
236
|
-
result.
|
236
|
+
expect(result).to be_true
|
237
237
|
end
|
238
238
|
|
239
239
|
end
|
@@ -18,7 +18,7 @@ describe Octokit::Client::PubSubHubbub::ServiceHooks do
|
|
18
18
|
with(subscribe_request_body).
|
19
19
|
to_return(:body => nil)
|
20
20
|
|
21
|
-
client.subscribe_service_hook("joshk/completeness-fu", "Travis", { :token => 'travistoken' }).
|
21
|
+
expect(client.subscribe_service_hook("joshk/completeness-fu", "Travis", { :token => 'travistoken' })).to eq(true)
|
22
22
|
assert_requested :post, "https://api.github.com/hub?access_token=myfaketoken", :body => subscribe_request_body, :times => 1
|
23
23
|
end
|
24
24
|
end
|
@@ -37,7 +37,7 @@ describe Octokit::Client::PubSubHubbub::ServiceHooks do
|
|
37
37
|
with(unsubscribe_request_body).
|
38
38
|
to_return(:body => nil)
|
39
39
|
|
40
|
-
client.unsubscribe_service_hook("joshk/completeness-fu", "Travis").
|
40
|
+
expect(client.unsubscribe_service_hook("joshk/completeness-fu", "Travis")).to eq(true)
|
41
41
|
assert_requested :post, "https://api.github.com/hub?access_token=myfaketoken", :body => unsubscribe_request_body, :times => 1
|
42
42
|
end
|
43
43
|
end
|
@@ -14,7 +14,7 @@ describe Octokit::Client::PubSubHubbub do
|
|
14
14
|
}).
|
15
15
|
to_return(:body => nil)
|
16
16
|
|
17
|
-
client.subscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken").
|
17
|
+
expect(client.subscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken")).to eq(true)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "raises an error if the topic is not recognized" do
|
@@ -26,9 +26,9 @@ describe Octokit::Client::PubSubHubbub do
|
|
26
26
|
}).
|
27
27
|
to_return(:status => 422)
|
28
28
|
|
29
|
-
|
29
|
+
expect {
|
30
30
|
client.subscribe("https://github.com/joshk/completeness-fud/events/push", "github://Travis?token=travistoken")
|
31
|
-
}.
|
31
|
+
}.to raise_exception
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -42,7 +42,7 @@ describe Octokit::Client::PubSubHubbub do
|
|
42
42
|
}).
|
43
43
|
to_return(:body => nil)
|
44
44
|
|
45
|
-
client.unsubscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken").
|
45
|
+
expect(client.unsubscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken")).to eq(true)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|