octokit 1.17.0 → 1.17.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,105 +9,105 @@ describe Octokit::Client::Pulls do
|
|
9
9
|
|
10
10
|
describe ".create_pull_request" do
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "creates a pull request" do
|
13
13
|
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls").
|
14
14
|
with(:pull => {:base => "master", :head => "pengwynn:master", :title => "Title", :body => "Body"}).
|
15
15
|
to_return(:body => fixture("v3/pull_created.json"))
|
16
16
|
pull = @client.create_pull_request("pengwynn/octokit", "master", "pengwynn:master", "Title", "Body")
|
17
|
-
pull.number.
|
18
|
-
pull.title.
|
17
|
+
expect(pull.number).to eq(15)
|
18
|
+
expect(pull.title).to eq("Pull this awesome v3 stuff")
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe ".create_pull_request_for_issue" do
|
24
24
|
|
25
|
-
it "
|
25
|
+
it "creates a pull request and attach it to an existing issue" do
|
26
26
|
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls").
|
27
27
|
with(:pull => {:base => "master", :head => "pengwynn:octokit", :issue => "15"}).
|
28
28
|
to_return(:body => fixture("v3/pull_created.json"))
|
29
29
|
pull = @client.create_pull_request_for_issue("pengwynn/octokit", "master", "pengwynn:octokit", "15")
|
30
|
-
pull.number.
|
30
|
+
expect(pull.number).to eq(15)
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe ".pull_requests" do
|
36
36
|
|
37
|
-
it "
|
37
|
+
it "returns all pull requests" do
|
38
38
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls?state=open").
|
39
39
|
to_return(:body => fixture("v3/pull_requests.json"))
|
40
40
|
pulls = @client.pulls("pengwynn/octokit")
|
41
|
-
pulls.first.number.
|
41
|
+
expect(pulls.first.number).to eq(928)
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe ".pull_request" do
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "returns a pull request" do
|
49
49
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67").
|
50
50
|
to_return(:body => fixture("v3/pull_request.json"))
|
51
51
|
pull = @client.pull("pengwynn/octokit", 67)
|
52
|
-
pull.number.
|
52
|
+
expect(pull.number).to eq(67)
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
56
56
|
|
57
57
|
describe ".pull_request_commits" do
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "returns the commits for a pull request" do
|
60
60
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67/commits").
|
61
61
|
to_return(:body => fixture("v3/pull_request_commits.json"))
|
62
62
|
commits = @client.pull_commits("pengwynn/octokit", 67)
|
63
|
-
commits.first["sha"].
|
63
|
+
expect(commits.first["sha"]).to eq("2097821c7c5aa4dc02a2cc54d5ca51968b373f95")
|
64
64
|
end
|
65
65
|
|
66
66
|
end
|
67
67
|
|
68
68
|
describe ".pull_request_comments" do
|
69
69
|
|
70
|
-
it "
|
70
|
+
it "returns the comments for a pull request" do
|
71
71
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67/comments").
|
72
72
|
to_return(:body => fixture("v3/pull_request_comments.json"))
|
73
73
|
commits = @client.pull_comments("pengwynn/octokit", 67)
|
74
|
-
commits.first["id"].
|
74
|
+
expect(commits.first["id"]).to eq(401530)
|
75
75
|
end
|
76
76
|
|
77
77
|
end
|
78
78
|
|
79
79
|
describe ".merge_pull_request" do
|
80
80
|
|
81
|
-
it "
|
81
|
+
it "merges the pull request" do
|
82
82
|
stub_put("https://api.github.com/repos/pengwynn/octokit/pulls/67/merge").
|
83
83
|
to_return(:body => fixture("v3/pull_request_merged.json"))
|
84
84
|
response = @client.merge_pull_request("pengwynn/octokit", 67)
|
85
|
-
response["sha"].
|
85
|
+
expect(response["sha"]).to eq("2097821c7c5aa4dc02a2cc54d5ca51968b373f95")
|
86
86
|
end
|
87
87
|
|
88
88
|
end
|
89
89
|
|
90
90
|
describe ".pull_request_files" do
|
91
91
|
|
92
|
-
it "
|
92
|
+
it "lists files for a pull request" do
|
93
93
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/142/files").
|
94
94
|
to_return(:body => fixture("v3/pull_request_files.json"))
|
95
95
|
|
96
96
|
files = @client.pull_request_files("pengwynn/octokit", 142)
|
97
97
|
file = files.first
|
98
|
-
file.filename.
|
99
|
-
file.additions.
|
98
|
+
expect(file.filename).to eq('README.md')
|
99
|
+
expect(file.additions).to eq(28)
|
100
100
|
end
|
101
101
|
|
102
102
|
end
|
103
103
|
|
104
104
|
describe ".pull_merged?" do
|
105
105
|
|
106
|
-
it "
|
106
|
+
it "returns whether the pull request has been merged" do
|
107
107
|
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67/merged").
|
108
108
|
to_return(:status => 204)
|
109
109
|
merged = @client.pull_merged?("pengwynn/octokit", 67)
|
110
|
-
merged.
|
110
|
+
expect(merged).to be_true
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
@@ -9,68 +9,68 @@ describe Octokit::Client::Refs do
|
|
9
9
|
|
10
10
|
describe ".refs" do
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "returns all refs" do
|
13
13
|
stub_get("/repos/sferik/rails_admin/git/refs/").
|
14
14
|
to_return(:body => fixture("v3/refs.json"))
|
15
15
|
refs = @client.refs("sferik/rails_admin")
|
16
|
-
refs.first.ref.
|
16
|
+
expect(refs.first.ref).to eq("refs/heads/actions")
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "returns all tag refs" do
|
20
20
|
stub_get("/repos/sferik/rails_admin/git/refs/tags").
|
21
21
|
to_return(:body => fixture("v3/refs_tags.json"))
|
22
22
|
refs = @client.refs("sferik/rails_admin","tags")
|
23
|
-
refs.first.ref.
|
23
|
+
expect(refs.first.ref).to eq("refs/tags/v0.0.1")
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
27
27
|
|
28
28
|
describe ".ref" do
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "returns the tags/v0.0.3 ref" do
|
31
31
|
stub_get("/repos/sferik/rails_admin/git/refs/tags/v0.0.3").
|
32
32
|
to_return(:body => fixture("v3/ref.json"))
|
33
33
|
ref = @client.ref("sferik/rails_admin","tags/v0.0.3")
|
34
|
-
ref.object.type.
|
35
|
-
ref.ref.
|
36
|
-
ref.url.
|
34
|
+
expect(ref.object.type).to eq("tag")
|
35
|
+
expect(ref.ref).to eq("refs/tags/v0.0.3")
|
36
|
+
expect(ref.url).to eq("https://api.github.com/repos/sferik/rails_admin/git/refs/tags/v0.0.3")
|
37
37
|
end
|
38
38
|
|
39
39
|
end
|
40
40
|
|
41
41
|
describe ".create_ref" do
|
42
42
|
|
43
|
-
it "
|
43
|
+
it "creates a ref" do
|
44
44
|
stub_post("/repos/octocat/Hello-World/git/refs").
|
45
45
|
with(:body => { "ref" => "refs/heads/master", "sha" => "827efc6d56897b048c772eb4087f854f46256132" },
|
46
46
|
:headers => {'Content-Type'=>'application/json'}).
|
47
47
|
to_return(:body => fixture("v3/ref_create.json"))
|
48
48
|
ref = @client.create_ref("octocat/Hello-World","heads/master", "827efc6d56897b048c772eb4087f854f46256132")
|
49
|
-
ref.first.ref.
|
49
|
+
expect(ref.first.ref).to eq("refs/heads/master")
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
53
53
|
|
54
54
|
describe ".update_ref" do
|
55
55
|
|
56
|
-
it "
|
56
|
+
it "updates a ref" do
|
57
57
|
stub_patch("/repos/octocat/Hello-World/git/refs/heads/sc/featureA").
|
58
58
|
with(:body => { "sha" => "aa218f56b14c9653891f9e74264a383fa43fefbd", "force" => true },
|
59
59
|
:headers => {'Content-Type'=>'application/json'}).
|
60
60
|
to_return(:body => fixture("v3/ref_update.json"))
|
61
61
|
refs = @client.update_ref("octocat/Hello-World","heads/sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd", true)
|
62
|
-
refs.first.ref.
|
63
|
-
refs.first.object.sha.
|
62
|
+
expect(refs.first.ref).to eq("refs/heads/sc/featureA")
|
63
|
+
expect(refs.first.object.sha).to eq("aa218f56b14c9653891f9e74264a383fa43fefbd")
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
describe ".delete_ref" do
|
68
68
|
|
69
|
-
it "
|
69
|
+
it "deletes an existing ref" do
|
70
70
|
stub_delete("/repos/octocat/Hello-World/git/refs/heads/feature-a").
|
71
71
|
to_return(:status => 204)
|
72
72
|
ref = @client.delete_ref("octocat/Hello-World", "heads/feature-a")
|
73
|
-
ref.status.
|
73
|
+
expect(ref.status).to eq(204)
|
74
74
|
end
|
75
75
|
|
76
76
|
end
|
@@ -9,35 +9,35 @@ describe Octokit::Client::Repositories do
|
|
9
9
|
|
10
10
|
describe ".search_user" do
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "returns matching repositories" do
|
13
13
|
stub_get("https://api.github.com/legacy/repos/search/One40Proof").
|
14
14
|
to_return(:body => fixture("legacy/repositories.json"))
|
15
15
|
repositories = @client.search_repositories("One40Proof")
|
16
|
-
repositories.first.name.
|
16
|
+
expect(repositories.first.name).to eq("One40Proof")
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe ".repository" do
|
22
22
|
|
23
|
-
it "
|
23
|
+
it "returns the matching repository" do
|
24
24
|
stub_get("/repos/sferik/rails_admin").
|
25
25
|
to_return(:body => fixture("v3/repository.json"))
|
26
26
|
repository = @client.repository("sferik/rails_admin")
|
27
|
-
repository.name.
|
27
|
+
expect(repository.name).to eq("rails_admin")
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
31
31
|
|
32
32
|
describe ".update_repository" do
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "updates the matching repository" do
|
35
35
|
description = "RailsAdmin is a Rails 3 engine that provides an easy-to-use interface for managing your data"
|
36
36
|
stub_patch("/repos/sferik/rails_admin").
|
37
37
|
with(:body => {:description => description}).
|
38
38
|
to_return(:body => fixture("v3/repository.json"))
|
39
39
|
repository = @client.edit_repository("sferik/rails_admin", :description => description)
|
40
|
-
repository.description.
|
40
|
+
expect(repository.description).to eq(description)
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|
@@ -46,22 +46,22 @@ describe Octokit::Client::Repositories do
|
|
46
46
|
|
47
47
|
context "with a username passed" do
|
48
48
|
|
49
|
-
it "
|
49
|
+
it "returns user's repositories" do
|
50
50
|
stub_get("/users/sferik/repos").
|
51
51
|
to_return(:body => fixture("v3/repositories.json"))
|
52
52
|
repositories = @client.repositories("sferik")
|
53
|
-
repositories.first.name.
|
53
|
+
expect(repositories.first.name).to eq("merb-admin")
|
54
54
|
end
|
55
55
|
|
56
56
|
end
|
57
57
|
|
58
58
|
context "without a username passed" do
|
59
59
|
|
60
|
-
it "
|
60
|
+
it "returns authenticated user's repositories" do
|
61
61
|
stub_get("/user/repos").
|
62
62
|
to_return(:body => fixture("v3/repositories.json"))
|
63
63
|
repositories = @client.repositories
|
64
|
-
repositories.first.name.
|
64
|
+
expect(repositories.first.name).to eq("merb-admin")
|
65
65
|
end
|
66
66
|
|
67
67
|
end
|
@@ -70,186 +70,186 @@ describe Octokit::Client::Repositories do
|
|
70
70
|
|
71
71
|
describe ".star" do
|
72
72
|
|
73
|
-
it "
|
73
|
+
it "stars a repository" do
|
74
74
|
stub_put("/user/starred/sferik/rails_admin").
|
75
75
|
to_return(:status => 204)
|
76
|
-
@client.star("sferik/rails_admin").
|
76
|
+
expect(@client.star("sferik/rails_admin")).to be_true
|
77
77
|
end
|
78
78
|
|
79
79
|
end
|
80
80
|
|
81
81
|
describe ".unstar" do
|
82
82
|
|
83
|
-
it "
|
83
|
+
it "unstars a repository" do
|
84
84
|
stub_delete("/user/starred/sferik/rails_admin").
|
85
85
|
to_return(:status => 204)
|
86
|
-
@client.unstar("sferik/rails_admin").
|
86
|
+
expect(@client.unstar("sferik/rails_admin")).to be_true
|
87
87
|
end
|
88
88
|
|
89
89
|
end
|
90
90
|
|
91
91
|
describe ".watch" do
|
92
92
|
|
93
|
-
it "
|
93
|
+
it "watches a repository" do
|
94
94
|
stub_put("/user/watched/sferik/rails_admin").
|
95
95
|
to_return(:status => 204)
|
96
|
-
@client.watch("sferik/rails_admin").
|
96
|
+
expect(@client.watch("sferik/rails_admin")).to be_true
|
97
97
|
end
|
98
98
|
|
99
99
|
end
|
100
100
|
|
101
101
|
describe ".unwatch" do
|
102
102
|
|
103
|
-
it "
|
103
|
+
it "unwatches a repository" do
|
104
104
|
stub_delete("/user/watched/sferik/rails_admin").
|
105
105
|
to_return(:status => 204)
|
106
|
-
@client.unwatch("sferik/rails_admin").
|
106
|
+
expect(@client.unwatch("sferik/rails_admin")).to be_true
|
107
107
|
end
|
108
108
|
|
109
109
|
end
|
110
110
|
|
111
111
|
describe ".fork" do
|
112
112
|
|
113
|
-
it "
|
113
|
+
it "forks a repository" do
|
114
114
|
stub_post("/repos/sferik/rails_admin/forks").
|
115
115
|
to_return(:body => fixture("v3/repository.json"))
|
116
116
|
repository = @client.fork("sferik/rails_admin")
|
117
|
-
repository.name.
|
117
|
+
expect(repository.name).to eq("rails_admin")
|
118
118
|
end
|
119
119
|
|
120
120
|
end
|
121
121
|
|
122
122
|
describe ".create_repository" do
|
123
123
|
|
124
|
-
it "
|
124
|
+
it "creates a repository" do
|
125
125
|
stub_post("/user/repos").
|
126
126
|
with(:name => "rails_admin").
|
127
127
|
to_return(:body => fixture("v3/repository.json"))
|
128
128
|
repository = @client.create_repository("rails_admin")
|
129
|
-
repository.name.
|
129
|
+
expect(repository.name).to eq("rails_admin")
|
130
130
|
end
|
131
131
|
|
132
|
-
it "
|
132
|
+
it "creates a repository for an organization" do
|
133
133
|
stub_post("/orgs/comorichwebgroup/repos").
|
134
134
|
with(:name => "demo").
|
135
135
|
to_return(:body => fixture("v3/organization-repository.json"))
|
136
136
|
repository = @client.create_repository("demo", {:organization => 'comorichwebgroup'})
|
137
|
-
repository.name.
|
138
|
-
repository.organization.login.
|
137
|
+
expect(repository.name).to eq("demo")
|
138
|
+
expect(repository.organization.login).to eq("CoMoRichWebGroup")
|
139
139
|
end
|
140
140
|
|
141
141
|
end
|
142
142
|
|
143
143
|
describe ".delete_repository" do
|
144
144
|
|
145
|
-
it "
|
145
|
+
it "deletes a repository" do
|
146
146
|
stub_delete("/repos/sferik/rails_admin").
|
147
147
|
to_return(:status => 204, :body => "")
|
148
148
|
result = @client.delete_repository("sferik/rails_admin")
|
149
|
-
result.
|
149
|
+
expect(result).to be_true
|
150
150
|
end
|
151
151
|
|
152
152
|
end
|
153
153
|
|
154
154
|
describe ".set_private" do
|
155
155
|
|
156
|
-
it "
|
156
|
+
it "sets a repository private" do
|
157
157
|
stub_patch("/repos/sferik/rails_admin").
|
158
158
|
with({ :name => "rails_admin", :private => false }).
|
159
159
|
to_return(:body => fixture("v3/repository.json"))
|
160
160
|
repository = @client.set_private("sferik/rails_admin")
|
161
|
-
repository.name.
|
161
|
+
expect(repository.name).to eq("rails_admin")
|
162
162
|
end
|
163
163
|
|
164
164
|
end
|
165
165
|
|
166
166
|
describe ".set_public" do
|
167
167
|
|
168
|
-
it "
|
168
|
+
it "sets a repository public" do
|
169
169
|
stub_patch("/repos/sferik/rails_admin").
|
170
170
|
with({ :name => "rails_admin", :private => true }).
|
171
171
|
to_return(:body => fixture("v3/repository.json"))
|
172
172
|
repository = @client.set_public("sferik/rails_admin")
|
173
|
-
repository.name.
|
174
|
-
repository.private.
|
173
|
+
expect(repository.name).to eq("rails_admin")
|
174
|
+
expect(repository.private).to eq(false)
|
175
175
|
end
|
176
176
|
|
177
177
|
end
|
178
178
|
|
179
179
|
describe ".deploy_keys" do
|
180
180
|
|
181
|
-
it "
|
181
|
+
it "returns a repository's deploy keys" do
|
182
182
|
stub_get("/repos/sferik/rails_admin/keys").
|
183
183
|
to_return(:body => fixture("v3/public_keys.json"))
|
184
184
|
public_keys = @client.deploy_keys("sferik/rails_admin")
|
185
|
-
public_keys.first.id.
|
185
|
+
expect(public_keys.first.id).to eq(103205)
|
186
186
|
end
|
187
187
|
|
188
188
|
end
|
189
189
|
|
190
190
|
describe ".add_deploy_key" do
|
191
191
|
|
192
|
-
it "
|
192
|
+
it "adds a repository deploy keys" do
|
193
193
|
stub_post("/repos/sferik/rails_admin/keys").
|
194
194
|
with(:body => { :title => "Moss", :key => "ssh-dss AAAAB3NzaC1kc3MAAACBAJz7HanBa18ad1YsdFzHO5Wy1/WgXd4BV+czbKq7q23jungbfjN3eo2a0SVdxux8GG+RZ9ia90VD/X+PE4s3LV60oXZ7PDAuyPO1CTF0TaDoKf9mPaHcPa6agMJVocMsgBgwviWT1Q9VgN1SccDsYVDtxkIAwuw25YeHZlG6myx1AAAAFQCgW+OvXWUdUJPBGkRJ8ML7uf0VHQAAAIAlP5G96tTss0SKYVSCJCyocn9cyGQdNjxah4/aYuYFTbLI1rxk7sr/AkZfJNIoF2UFyO5STbbratykIQGUPdUBg1a2t72bu31x+4ZYJMngNsG/AkZ2oqLiH6dJKHD7PFx2oSPalogwsUV7iSMIZIYaPa03A9763iFsN0qJjaed+gAAAIBxz3Prxdzt/os4XGXSMNoWcS03AFC/05NOkoDMrXxQnTTpp1wrOgyRqEnKz15qC5dWk1ynzK+LJXHDZGA8lXPfCjHpJO3zrlZ/ivvLhgPdDpt13MAhIJFH06hTal0woxbk/fIdY71P3kbgXC0Ppx/0S7BC+VxqRCA4/wcM+BoDbA== host" }).
|
195
195
|
to_return(:body => fixture("v3/public_key.json"))
|
196
196
|
public_key = @client.add_deploy_key("sferik/rails_admin", "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")
|
197
|
-
public_key.id.
|
197
|
+
expect(public_key.id).to eq(103205)
|
198
198
|
end
|
199
199
|
|
200
200
|
end
|
201
201
|
|
202
202
|
describe ".remove_deploy_key" do
|
203
203
|
|
204
|
-
it "
|
204
|
+
it "removes a repository deploy keys" do
|
205
205
|
stub_delete("/repos/sferik/rails_admin/keys/#{103205}").
|
206
206
|
to_return(:status => 204)
|
207
207
|
result = @client.remove_deploy_key("sferik/rails_admin", 103205)
|
208
|
-
result.
|
208
|
+
expect(result).to be_nil
|
209
209
|
end
|
210
210
|
|
211
211
|
end
|
212
212
|
|
213
213
|
describe ".collaborators" do
|
214
214
|
|
215
|
-
it "
|
215
|
+
it "returns a repository's collaborators" do
|
216
216
|
stub_get("/repos/sferik/rails_admin/collaborators").
|
217
217
|
to_return(:body => fixture("v3/collaborators.json"))
|
218
218
|
collaborators = @client.collaborators("sferik/rails_admin")
|
219
|
-
collaborators.first.login.
|
219
|
+
expect(collaborators.first.login).to eq("sferik")
|
220
220
|
end
|
221
221
|
|
222
222
|
end
|
223
223
|
|
224
224
|
describe ".add_collaborator" do
|
225
225
|
|
226
|
-
it "
|
226
|
+
it "adds a repository collaborators" do
|
227
227
|
stub_put("/repos/sferik/rails_admin/collaborators/sferik").
|
228
228
|
to_return(:status => 204)
|
229
229
|
result = @client.add_collaborator("sferik/rails_admin", "sferik")
|
230
|
-
result.
|
230
|
+
expect(result).to be_nil
|
231
231
|
end
|
232
232
|
|
233
233
|
end
|
234
234
|
|
235
235
|
describe ".remove_collaborator" do
|
236
236
|
|
237
|
-
it "
|
237
|
+
it "removes a repository collaborators" do
|
238
238
|
stub_delete("/repos/sferik/rails_admin/collaborators/sferik").
|
239
239
|
to_return(:status => 204)
|
240
240
|
result = @client.remove_collaborator("sferik/rails_admin", "sferik")
|
241
|
-
result.
|
241
|
+
expect(result).to be_nil
|
242
242
|
end
|
243
243
|
|
244
244
|
end
|
245
245
|
|
246
246
|
describe ".repository_teams" do
|
247
247
|
|
248
|
-
it "
|
248
|
+
it "returns all repository teams" do
|
249
249
|
stub_get("/repos/codeforamerica/open311/teams").
|
250
250
|
to_return(:body => fixture("v3/teams.json"))
|
251
251
|
teams = @client.repository_teams("codeforamerica/open311")
|
252
|
-
teams.first.name.
|
252
|
+
expect(teams.first.name).to eq("Fellows")
|
253
253
|
end
|
254
254
|
|
255
255
|
end
|
@@ -258,22 +258,22 @@ describe Octokit::Client::Repositories do
|
|
258
258
|
|
259
259
|
context "with anonymous users" do
|
260
260
|
|
261
|
-
it "
|
261
|
+
it "returns all repository contributors" do
|
262
262
|
stub_get("/repos/sferik/rails_admin/contributors?anon=true").
|
263
263
|
to_return(:body => fixture("v3/contributors.json"))
|
264
264
|
contributors = @client.contributors("sferik/rails_admin", true)
|
265
|
-
contributors.first.login.
|
265
|
+
expect(contributors.first.login).to eq("sferik")
|
266
266
|
end
|
267
267
|
|
268
268
|
end
|
269
269
|
|
270
270
|
context "without anonymous users" do
|
271
271
|
|
272
|
-
it "
|
272
|
+
it "returns all repository contributors" do
|
273
273
|
stub_get("/repos/sferik/rails_admin/contributors?anon=false").
|
274
274
|
to_return(:body => fixture("v3/contributors.json"))
|
275
275
|
contributors = @client.contributors("sferik/rails_admin")
|
276
|
-
contributors.first.login.
|
276
|
+
expect(contributors.first.login).to eq("sferik")
|
277
277
|
end
|
278
278
|
|
279
279
|
end
|
@@ -282,167 +282,167 @@ describe Octokit::Client::Repositories do
|
|
282
282
|
|
283
283
|
describe ".stargazers" do
|
284
284
|
|
285
|
-
it "
|
285
|
+
it "returns all repository stargazers" do
|
286
286
|
stub_get("/repos/sferik/rails_admin/stargazers").
|
287
287
|
to_return(:body => fixture("v3/stargazers.json"))
|
288
288
|
stargazers = @client.stargazers("sferik/rails_admin")
|
289
|
-
stargazers.first.login.
|
289
|
+
expect(stargazers.first.login).to eq("sferik")
|
290
290
|
end
|
291
291
|
|
292
292
|
end
|
293
293
|
|
294
294
|
describe ".watchers" do
|
295
295
|
|
296
|
-
it "
|
296
|
+
it "returns all repository watchers" do
|
297
297
|
stub_get("/repos/sferik/rails_admin/watchers").
|
298
298
|
to_return(:body => fixture("v3/watchers.json"))
|
299
299
|
watchers = @client.watchers("sferik/rails_admin")
|
300
|
-
watchers.first.login.
|
300
|
+
expect(watchers.first.login).to eq("sferik")
|
301
301
|
end
|
302
302
|
|
303
303
|
end
|
304
304
|
|
305
305
|
describe ".network" do
|
306
306
|
|
307
|
-
it "
|
307
|
+
it "returns a repository's network" do
|
308
308
|
stub_get("/repos/sferik/rails_admin/forks").
|
309
309
|
to_return(:body => fixture("v3/forks.json"))
|
310
310
|
network = @client.network("sferik/rails_admin")
|
311
|
-
network.first.owner.login.
|
311
|
+
expect(network.first.owner.login).to eq("digx")
|
312
312
|
end
|
313
313
|
|
314
314
|
end
|
315
315
|
|
316
316
|
describe ".languages" do
|
317
317
|
|
318
|
-
it "
|
318
|
+
it "returns a repository's languages" do
|
319
319
|
stub_get("/repos/sferik/rails_admin/languages").
|
320
320
|
to_return(:body => fixture("v3/languages.json"))
|
321
321
|
languages = @client.languages("sferik/rails_admin")
|
322
|
-
languages["Ruby"].
|
322
|
+
expect(languages["Ruby"]).to eq(345701)
|
323
323
|
end
|
324
324
|
|
325
325
|
end
|
326
326
|
|
327
327
|
describe ".tags" do
|
328
328
|
|
329
|
-
it "
|
329
|
+
it "returns a repository's tags" do
|
330
330
|
stub_get("/repos/pengwynn/octokit/tags").
|
331
331
|
to_return(:body => fixture("v3/tags.json"))
|
332
332
|
tags = @client.tags("pengwynn/octokit")
|
333
333
|
v0_6_4 = tags.find { |tag| tag.name == "v0.6.4" }
|
334
|
-
v0_6_4.commit.sha.
|
334
|
+
expect(v0_6_4.commit.sha).to eq("09bcc30e7286eeb1bbde68d0ace7a6b90b1a84a2")
|
335
335
|
end
|
336
336
|
|
337
337
|
end
|
338
338
|
|
339
339
|
describe ".branches" do
|
340
340
|
|
341
|
-
it "
|
341
|
+
it "returns a repository's branches" do
|
342
342
|
stub_get("/repos/pengwynn/octokit/branches").
|
343
343
|
to_return(:body => fixture("v3/branches.json"))
|
344
344
|
branches = @client.branches("pengwynn/octokit")
|
345
345
|
master = branches.find { |branch| branch.name == "master" }
|
346
|
-
master.commit.sha.
|
346
|
+
expect(master.commit.sha).to eq("88553a397f7293b3ba176dc27cd1ab6bb93d5d14")
|
347
347
|
end
|
348
348
|
|
349
|
-
it "
|
349
|
+
it "returns a single branch" do
|
350
350
|
branch = JSON.parse(fixture("v3/branches.json").read).last
|
351
351
|
stub_get("/repos/pengwynn/octokit/branches/master").
|
352
352
|
to_return(:body => branch)
|
353
353
|
branch = @client.branch("pengwynn/octokit", "master")
|
354
|
-
branch.commit.sha.
|
354
|
+
expect(branch.commit.sha).to eq("88553a397f7293b3ba176dc27cd1ab6bb93d5d14")
|
355
355
|
end
|
356
356
|
|
357
357
|
end
|
358
358
|
|
359
359
|
describe ".hooks" do
|
360
360
|
|
361
|
-
it "
|
361
|
+
it "returns a repository's hooks" do
|
362
362
|
stub_get("/repos/railsbp/railsbp.com/hooks").
|
363
363
|
to_return(:body => fixture("v3/hooks.json"))
|
364
364
|
hooks = @client.hooks("railsbp/railsbp.com")
|
365
365
|
hook = hooks.find { |hook| hook.name == "railsbp" }
|
366
|
-
hook.config.token.
|
366
|
+
expect(hook.config.token).to eq("xAAQZtJhYHGagsed1kYR")
|
367
367
|
end
|
368
368
|
|
369
369
|
end
|
370
370
|
|
371
371
|
describe ".hook" do
|
372
372
|
|
373
|
-
it "
|
373
|
+
it "returns a repository's single hook" do
|
374
374
|
stub_get("/repos/railsbp/railsbp.com/hooks/154284").
|
375
375
|
to_return(:body => fixture("v3/hook.json"))
|
376
376
|
hook = @client.hook("railsbp/railsbp.com", 154284)
|
377
|
-
hook.config.token.
|
377
|
+
expect(hook.config.token).to eq("xAAQZtJhYHGagsed1kYR")
|
378
378
|
end
|
379
379
|
|
380
380
|
end
|
381
381
|
|
382
382
|
describe ".create_hook" do
|
383
383
|
|
384
|
-
it "
|
384
|
+
it "creates a hook" do
|
385
385
|
stub_post("/repos/railsbp/railsbp.com/hooks").
|
386
386
|
with(:body => {:name => "railsbp", :config => {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"}, :events => ["push"], :active => true}).
|
387
387
|
to_return(:body => fixture("v3/hook.json"))
|
388
388
|
hook = @client.create_hook("railsbp/railsbp.com", "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
389
|
-
hook.id.
|
389
|
+
expect(hook.id).to eq(154284)
|
390
390
|
end
|
391
391
|
|
392
392
|
end
|
393
393
|
|
394
394
|
describe ".edit_hook" do
|
395
395
|
|
396
|
-
it "
|
396
|
+
it "edits a hook" do
|
397
397
|
stub_patch("/repos/railsbp/railsbp.com/hooks/154284").
|
398
398
|
with(:body => {:name => "railsbp", :config => {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"}, :events => ["push"], :active => true}).
|
399
399
|
to_return(:body => fixture("v3/hook.json"))
|
400
400
|
hook = @client.edit_hook("railsbp/railsbp.com", 154284, "railsbp", {:railsbp_url => "http://railsbp.com", :token => "xAAQZtJhYHGagsed1kYR"})
|
401
|
-
hook.id.
|
402
|
-
hook.config.token.
|
401
|
+
expect(hook.id).to eq(154284)
|
402
|
+
expect(hook.config.token).to eq("xAAQZtJhYHGagsed1kYR")
|
403
403
|
end
|
404
404
|
|
405
405
|
end
|
406
406
|
|
407
407
|
describe ".remove_hook" do
|
408
408
|
|
409
|
-
it "
|
409
|
+
it "removes a hook" do
|
410
410
|
stub_delete("/repos/railsbp/railsbp.com/hooks/154284").
|
411
411
|
to_return(:status => 204)
|
412
|
-
@client.remove_hook("railsbp/railsbp.com", 154284).
|
412
|
+
expect(@client.remove_hook("railsbp/railsbp.com", 154284)).to be_nil
|
413
413
|
end
|
414
414
|
|
415
415
|
end
|
416
416
|
|
417
417
|
describe ".test_hook" do
|
418
418
|
|
419
|
-
it "
|
419
|
+
it "tests a hook" do
|
420
420
|
stub_post("/repos/railsbp/railsbp.com/hooks/154284/test").
|
421
421
|
to_return(:status => 204)
|
422
|
-
@client.test_hook("railsbp/railsbp.com", 154284).
|
422
|
+
expect(@client.test_hook("railsbp/railsbp.com", 154284)).to be_nil
|
423
423
|
end
|
424
424
|
|
425
425
|
end
|
426
426
|
|
427
427
|
describe ".events" do
|
428
428
|
|
429
|
-
it "
|
429
|
+
it "lists events for all issues in a repository" do
|
430
430
|
stub_get("/repos/pengwynn/octokit/issues/events").
|
431
431
|
to_return(:body => fixture("v3/repo_issues_events.json"))
|
432
432
|
events = @client.repo_issue_events("pengwynn/octokit")
|
433
|
-
events.first.actor.login.
|
434
|
-
events.first.event.
|
433
|
+
expect(events.first.actor.login).to eq("ctshryock")
|
434
|
+
expect(events.first.event).to eq("subscribed")
|
435
435
|
end
|
436
436
|
|
437
437
|
end
|
438
438
|
|
439
439
|
describe ".assignees" do
|
440
440
|
|
441
|
-
it "
|
441
|
+
it "lists all the available assignees (owner + collaborators)" do
|
442
442
|
stub_get("/repos/pengwynn/octokit/assignees").
|
443
443
|
to_return(:body => fixture("v3/repo_assignees.json"))
|
444
|
-
assignees = @client.repo_assignees("pengwynn/octokit")
|
445
|
-
assignees.first.login.
|
444
|
+
assignees = @client.repo_assignees("pengwynn/octokit")
|
445
|
+
expect(assignees.first.login).to eq("adamstac")
|
446
446
|
end
|
447
447
|
|
448
448
|
end
|