octokit 0.6.4 → 0.6.5
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/.travis.yml +2 -2
- data/CHANGELOG.md +1 -0
- data/README.md +46 -24
- data/Rakefile +0 -0
- data/lib/octokit/authentication.rb +1 -3
- data/lib/octokit/client.rb +3 -1
- data/lib/octokit/client/commits.rb +3 -2
- data/lib/octokit/client/issues.rb +11 -62
- data/lib/octokit/client/labels.rb +153 -0
- data/lib/octokit/client/milestones.rb +1 -1
- data/lib/octokit/client/pub_sub_hubbub/service_hooks.rb +2 -4
- data/lib/octokit/client/repositories.rb +41 -31
- data/lib/octokit/client/timelines.rb +1 -2
- data/lib/octokit/configuration.rb +5 -12
- data/lib/octokit/repository.rb +1 -1
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +16 -25
- data/spec/fixtures/v3/branches.json +16 -0
- data/spec/fixtures/v3/collaborators.json +62 -0
- data/spec/fixtures/v3/commit.json +1 -0
- data/spec/fixtures/v3/commits.json +1 -0
- data/spec/fixtures/v3/contributors.json +891 -0
- data/spec/fixtures/v3/forks.json +872 -0
- data/spec/fixtures/v3/labels.json +3 -3
- data/spec/fixtures/v3/languages.json +5 -0
- data/spec/fixtures/v3/public_key.json +5 -0
- data/spec/fixtures/v3/public_keys.json +7 -0
- data/spec/fixtures/v3/repositories.json +872 -0
- data/spec/fixtures/v3/repository.json +34 -0
- data/spec/fixtures/v3/tags.json +173 -0
- data/spec/fixtures/v3/teams.json +12 -0
- data/spec/fixtures/v3/watchers.json +182 -0
- data/spec/helper.rb +3 -3
- data/spec/octokit/client/commits_spec.rb +5 -5
- data/spec/octokit/client/issues_spec.rb +14 -61
- data/spec/octokit/client/labels_spec.rb +152 -0
- data/spec/octokit/client/milestones_spec.rb +6 -6
- data/spec/octokit/client/objects_spec.rb +6 -6
- data/spec/octokit/client/organizations_spec.rb +19 -19
- data/spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb +2 -2
- data/spec/octokit/client/pub_sub_hubbub_spec.rb +3 -3
- data/spec/octokit/client/pulls_spec.rb +4 -4
- data/spec/octokit/client/repositories_spec.rb +81 -80
- data/spec/octokit/client/timelines_spec.rb +3 -3
- data/spec/octokit/client/users_spec.rb +21 -21
- data/spec/octokit/client_spec.rb +1 -11
- data/spec/octokit_spec.rb +1 -1
- metadata +125 -215
- data/.autotest +0 -1
- data/spec/fixtures/v2/branches.json +0 -1
- data/spec/fixtures/v2/collaborators.json +0 -1
- data/spec/fixtures/v2/commit.json +0 -1
- data/spec/fixtures/v2/commits.json +0 -1
- data/spec/fixtures/v2/contributors.json +0 -1
- data/spec/fixtures/v2/languages.json +0 -1
- data/spec/fixtures/v2/network.json +0 -1
- data/spec/fixtures/v2/repository.json +0 -1
- data/spec/fixtures/v2/watchers.json +0 -1
@@ -14,7 +14,7 @@ describe Octokit::Client::PubSubHubbub::ServiceHooks do
|
|
14
14
|
}
|
15
15
|
}
|
16
16
|
it "subscribes to pull events on specified topic" do
|
17
|
-
stub_post("
|
17
|
+
stub_post("/hub?access_token=myfaketoken").
|
18
18
|
with(subscribe_request_body).
|
19
19
|
to_return(:body => nil)
|
20
20
|
|
@@ -33,7 +33,7 @@ describe Octokit::Client::PubSubHubbub::ServiceHooks do
|
|
33
33
|
}
|
34
34
|
|
35
35
|
it "unsubscribes to stop receiving events on specified topic" do
|
36
|
-
stub_post("
|
36
|
+
stub_post("/hub?access_token=myfaketoken").
|
37
37
|
with(unsubscribe_request_body).
|
38
38
|
to_return(:body => nil)
|
39
39
|
|
@@ -6,7 +6,7 @@ describe Octokit::Client::PubSubHubbub do
|
|
6
6
|
|
7
7
|
describe ".subscribe" do
|
8
8
|
it "subscribes to pull events" do
|
9
|
-
stub_post("
|
9
|
+
stub_post("/hub?access_token=myfaketoken").
|
10
10
|
with({
|
11
11
|
:"hub.callback" => 'github://Travis?token=travistoken',
|
12
12
|
:"hub.mode" => 'subscribe',
|
@@ -18,7 +18,7 @@ describe Octokit::Client::PubSubHubbub do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "raises an error if the topic is not recognized" do
|
21
|
-
stub_post("
|
21
|
+
stub_post("/hub?access_token=myfaketoken").
|
22
22
|
with({
|
23
23
|
:"hub.callback" => 'github://Travis?token=travistoken',
|
24
24
|
:"hub.mode" => 'subscribe',
|
@@ -34,7 +34,7 @@ describe Octokit::Client::PubSubHubbub do
|
|
34
34
|
|
35
35
|
describe ".unsubscribe" do
|
36
36
|
it "unsubscribes from pull events" do
|
37
|
-
stub_post("
|
37
|
+
stub_post("/hub?access_token=myfaketoken").
|
38
38
|
with({
|
39
39
|
:"hub.callback" => 'github://Travis?token=travistoken',
|
40
40
|
:"hub.mode" => 'unsubscribe',
|
@@ -10,7 +10,7 @@ describe Octokit::Client::Pulls do
|
|
10
10
|
describe ".create_pull_request" do
|
11
11
|
|
12
12
|
it "should create a pull request" do
|
13
|
-
stub_post("/api/v2/json/pulls/sferik/rails_admin").
|
13
|
+
stub_post("https://github.com/api/v2/json/pulls/sferik/rails_admin").
|
14
14
|
with(:pull => {:base => "master", :head => "pengwynn:master", :title => "Title", :body => "Body"}).
|
15
15
|
to_return(:body => fixture("v2/pulls.json"))
|
16
16
|
issues = @client.create_pull_request("sferik/rails_admin", "master", "pengwynn:master", "Title", "Body")
|
@@ -22,7 +22,7 @@ describe Octokit::Client::Pulls do
|
|
22
22
|
describe ".create_pull_request_for_issue" do
|
23
23
|
|
24
24
|
it "should create a pull request and attach it to an existing issue" do
|
25
|
-
stub_post("/api/v2/json/pulls/pengwynn/octokit").
|
25
|
+
stub_post("https://github.com/api/v2/json/pulls/pengwynn/octokit").
|
26
26
|
with(:pull => {:base => "master", :head => "pengwynn:master", :issue => "34"}).
|
27
27
|
to_return(:body => fixture("v2/pulls.json"))
|
28
28
|
issues = @client.create_pull_request_for_issue("pengwynn/octokit", "master", "pengwynn:master", "34")
|
@@ -34,7 +34,7 @@ describe Octokit::Client::Pulls do
|
|
34
34
|
describe ".pull_requests" do
|
35
35
|
|
36
36
|
it "should return all pull requests" do
|
37
|
-
stub_get("/api/v2/json/pulls/sferik/rails_admin/open").
|
37
|
+
stub_get("https://github.com/api/v2/json/pulls/sferik/rails_admin/open").
|
38
38
|
to_return(:body => fixture("v2/pulls.json"))
|
39
39
|
pulls = @client.pulls("sferik/rails_admin")
|
40
40
|
pulls.first.number.should == 251
|
@@ -45,7 +45,7 @@ describe Octokit::Client::Pulls do
|
|
45
45
|
describe ".pull_request" do
|
46
46
|
|
47
47
|
it "should return a pull request" do
|
48
|
-
stub_get("/api/v2/json/pulls/sferik/rails_admin/251").
|
48
|
+
stub_get("https://github.com/api/v2/json/pulls/sferik/rails_admin/251").
|
49
49
|
to_return(:body => fixture("v2/pull.json"))
|
50
50
|
pull = @client.pull("sferik/rails_admin", 251)
|
51
51
|
pull.number.should == 251
|
@@ -10,7 +10,7 @@ describe Octokit::Client::Repositories do
|
|
10
10
|
describe ".search_user" do
|
11
11
|
|
12
12
|
it "should return matching repositories" do
|
13
|
-
stub_get("/api/v2/json/repos/search/One40Proof").
|
13
|
+
stub_get("https://github.com/api/v2/json/repos/search/One40Proof").
|
14
14
|
to_return(:body => fixture("v2/repositories.json"))
|
15
15
|
repositories = @client.search_repositories("One40Proof")
|
16
16
|
repositories.first.name.should == "One40Proof"
|
@@ -21,8 +21,8 @@ describe Octokit::Client::Repositories do
|
|
21
21
|
describe ".repository" do
|
22
22
|
|
23
23
|
it "should return the matching repository" do
|
24
|
-
stub_get("/
|
25
|
-
to_return(:body => fixture("
|
24
|
+
stub_get("/repos/sferik/rails_admin").
|
25
|
+
to_return(:body => fixture("v3/repository.json"))
|
26
26
|
repository = @client.repository("sferik/rails_admin")
|
27
27
|
repository.name.should == "rails_admin"
|
28
28
|
end
|
@@ -33,10 +33,10 @@ describe Octokit::Client::Repositories do
|
|
33
33
|
|
34
34
|
it "should update 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
|
-
|
37
|
-
with(:
|
38
|
-
to_return(:body => fixture("
|
39
|
-
repository = @client.
|
36
|
+
stub_patch("/repos/sferik/rails_admin").
|
37
|
+
with(:body => {:description => description}).
|
38
|
+
to_return(:body => fixture("v3/repository.json"))
|
39
|
+
repository = @client.edit_repository("sferik/rails_admin", :description => description)
|
40
40
|
repository.description.should == description
|
41
41
|
end
|
42
42
|
|
@@ -47,10 +47,10 @@ describe Octokit::Client::Repositories do
|
|
47
47
|
context "with a username passed" do
|
48
48
|
|
49
49
|
it "should return user's repositories" do
|
50
|
-
stub_get("/
|
51
|
-
to_return(:body => fixture("
|
50
|
+
stub_get("/users/sferik/repos").
|
51
|
+
to_return(:body => fixture("v3/repositories.json"))
|
52
52
|
repositories = @client.repositories("sferik")
|
53
|
-
repositories.first.name.should == "
|
53
|
+
repositories.first.name.should == "merb-admin"
|
54
54
|
end
|
55
55
|
|
56
56
|
end
|
@@ -58,10 +58,10 @@ describe Octokit::Client::Repositories do
|
|
58
58
|
context "without a username passed" do
|
59
59
|
|
60
60
|
it "should return authenticated user's repositories" do
|
61
|
-
stub_get("/
|
62
|
-
to_return(:body => fixture("
|
61
|
+
stub_get("/user/repos").
|
62
|
+
to_return(:body => fixture("v3/repositories.json"))
|
63
63
|
repositories = @client.repositories
|
64
|
-
repositories.first.name.should == "
|
64
|
+
repositories.first.name.should == "merb-admin"
|
65
65
|
end
|
66
66
|
|
67
67
|
end
|
@@ -71,10 +71,9 @@ describe Octokit::Client::Repositories do
|
|
71
71
|
describe ".watch" do
|
72
72
|
|
73
73
|
it "should watch a repository" do
|
74
|
-
|
75
|
-
to_return(:
|
76
|
-
|
77
|
-
repository.name.should == "rails_admin"
|
74
|
+
stub_put("/user/watched/sferik/rails_admin").
|
75
|
+
to_return(:status => 204)
|
76
|
+
@client.watch("sferik/rails_admin").should == ''
|
78
77
|
end
|
79
78
|
|
80
79
|
end
|
@@ -82,10 +81,9 @@ describe Octokit::Client::Repositories do
|
|
82
81
|
describe ".unwatch" do
|
83
82
|
|
84
83
|
it "should unwatch a repository" do
|
85
|
-
|
86
|
-
to_return(:
|
87
|
-
|
88
|
-
repository.name.should == "rails_admin"
|
84
|
+
stub_delete("/user/watched/sferik/rails_admin").
|
85
|
+
to_return(:status => 204)
|
86
|
+
@client.unwatch("sferik/rails_admin").should == ''
|
89
87
|
end
|
90
88
|
|
91
89
|
end
|
@@ -93,8 +91,8 @@ describe Octokit::Client::Repositories do
|
|
93
91
|
describe ".fork" do
|
94
92
|
|
95
93
|
it "should fork a repository" do
|
96
|
-
stub_post("/
|
97
|
-
to_return(:body => fixture("
|
94
|
+
stub_post("/repos/sferik/rails_admin/forks").
|
95
|
+
to_return(:body => fixture("v3/repository.json"))
|
98
96
|
repository = @client.fork("sferik/rails_admin")
|
99
97
|
repository.name.should == "rails_admin"
|
100
98
|
end
|
@@ -104,9 +102,9 @@ describe Octokit::Client::Repositories do
|
|
104
102
|
describe ".create_repository" do
|
105
103
|
|
106
104
|
it "should create a repository" do
|
107
|
-
stub_post("/
|
105
|
+
stub_post("/user/repos").
|
108
106
|
with(:name => "rails_admin").
|
109
|
-
to_return(:body => fixture("
|
107
|
+
to_return(:body => fixture("v3/repository.json"))
|
110
108
|
repository = @client.create_repository("rails_admin")
|
111
109
|
repository.name.should == "rails_admin"
|
112
110
|
end
|
@@ -116,7 +114,7 @@ describe Octokit::Client::Repositories do
|
|
116
114
|
describe ".delete_repository" do
|
117
115
|
|
118
116
|
it "should return a delete token" do
|
119
|
-
stub_post("/api/v2/json/repos/delete/sferik/rails_admin").
|
117
|
+
stub_post("https://github.com/api/v2/json/repos/delete/sferik/rails_admin").
|
120
118
|
to_return(:body => fixture("v2/delete_token.json"))
|
121
119
|
delete_token = @client.delete_repository("sferik/rails_admin")
|
122
120
|
delete_token.should == "uhihwkkkzu"
|
@@ -127,9 +125,9 @@ describe Octokit::Client::Repositories do
|
|
127
125
|
describe ".delete_repository!" do
|
128
126
|
|
129
127
|
it "should delete a repository" do
|
130
|
-
stub_post("/api/v2/json/repos/delete/sferik/rails_admin").
|
128
|
+
stub_post("https://github.com/api/v2/json/repos/delete/sferik/rails_admin").
|
131
129
|
to_return(:body => fixture("v2/delete_token.json"))
|
132
|
-
stub_post("/api/v2/json/repos/delete/sferik/rails_admin").
|
130
|
+
stub_post("https://github.com/api/v2/json/repos/delete/sferik/rails_admin").
|
133
131
|
with(:delete_token => "uhihwkkkzu").
|
134
132
|
to_return(:status => 204)
|
135
133
|
@client.delete_repo!("sferik/rails_admin")
|
@@ -140,7 +138,7 @@ describe Octokit::Client::Repositories do
|
|
140
138
|
describe ".delete_repository" do
|
141
139
|
|
142
140
|
it "should return an error for non-existant repo" do
|
143
|
-
stub_post("/api/v2/json/repos/delete/sferik/rails_admin_failure").
|
141
|
+
stub_post("https://github.com/api/v2/json/repos/delete/sferik/rails_admin_failure").
|
144
142
|
to_return(:body => fixture("v2/delete_failure.json"))
|
145
143
|
response = @client.delete_repository("sferik/rails_admin_failure")
|
146
144
|
response.error.should == "sferik/rails_admin_failure Repository not found"
|
@@ -151,8 +149,9 @@ describe Octokit::Client::Repositories do
|
|
151
149
|
describe ".set_private" do
|
152
150
|
|
153
151
|
it "should set a repository private" do
|
154
|
-
|
155
|
-
|
152
|
+
stub_patch("/repos/sferik/rails_admin").
|
153
|
+
with({ :name => "rails_admin", :public => false }).
|
154
|
+
to_return(:body => fixture("v3/repository.json"))
|
156
155
|
repository = @client.set_private("sferik/rails_admin")
|
157
156
|
repository.name.should == "rails_admin"
|
158
157
|
end
|
@@ -162,8 +161,9 @@ describe Octokit::Client::Repositories do
|
|
162
161
|
describe ".set_public" do
|
163
162
|
|
164
163
|
it "should set a repository public" do
|
165
|
-
|
166
|
-
|
164
|
+
stub_patch("/repos/sferik/rails_admin").
|
165
|
+
with({ :name => "rails_admin", :public => false }).
|
166
|
+
to_return(:body => fixture("v3/repository.json"))
|
167
167
|
repository = @client.set_public("sferik/rails_admin")
|
168
168
|
repository.name.should == "rails_admin"
|
169
169
|
end
|
@@ -173,8 +173,8 @@ describe Octokit::Client::Repositories do
|
|
173
173
|
describe ".deploy_keys" do
|
174
174
|
|
175
175
|
it "should return a repository's deploy keys" do
|
176
|
-
stub_get("/
|
177
|
-
to_return(:body => fixture("
|
176
|
+
stub_get("/repos/sferik/rails_admin/keys").
|
177
|
+
to_return(:body => fixture("v3/public_keys.json"))
|
178
178
|
public_keys = @client.deploy_keys("sferik/rails_admin")
|
179
179
|
public_keys.first.id.should == 103205
|
180
180
|
end
|
@@ -184,11 +184,11 @@ describe Octokit::Client::Repositories do
|
|
184
184
|
describe ".add_deploy_key" do
|
185
185
|
|
186
186
|
it "should add a repository deploy keys" do
|
187
|
-
stub_post("/
|
188
|
-
with(: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").
|
189
|
-
to_return(:body => fixture("
|
190
|
-
|
191
|
-
|
187
|
+
stub_post("/repos/sferik/rails_admin/keys").
|
188
|
+
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" }).
|
189
|
+
to_return(:body => fixture("v3/public_key.json"))
|
190
|
+
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")
|
191
|
+
public_key.id.should == 103205
|
192
192
|
end
|
193
193
|
|
194
194
|
end
|
@@ -196,11 +196,10 @@ describe Octokit::Client::Repositories do
|
|
196
196
|
describe ".remove_deploy_key" do
|
197
197
|
|
198
198
|
it "should remove a repository deploy keys" do
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
public_keys.first.id.should == 103205
|
199
|
+
stub_delete("/repos/sferik/rails_admin/keys/#{103205}").
|
200
|
+
to_return(:status => 204)
|
201
|
+
result = @client.remove_deploy_key("sferik/rails_admin", 103205)
|
202
|
+
result.should == ''
|
204
203
|
end
|
205
204
|
|
206
205
|
end
|
@@ -208,10 +207,10 @@ describe Octokit::Client::Repositories do
|
|
208
207
|
describe ".collaborators" do
|
209
208
|
|
210
209
|
it "should return a repository's collaborators" do
|
211
|
-
stub_get("/
|
212
|
-
to_return(:body => fixture("
|
210
|
+
stub_get("/repos/sferik/rails_admin/collaborators").
|
211
|
+
to_return(:body => fixture("v3/collaborators.json"))
|
213
212
|
collaborators = @client.collaborators("sferik/rails_admin")
|
214
|
-
collaborators.first.should == "sferik"
|
213
|
+
collaborators.first.login.should == "sferik"
|
215
214
|
end
|
216
215
|
|
217
216
|
end
|
@@ -219,10 +218,10 @@ describe Octokit::Client::Repositories do
|
|
219
218
|
describe ".add_collaborator" do
|
220
219
|
|
221
220
|
it "should add a repository collaborators" do
|
222
|
-
|
223
|
-
to_return(:
|
224
|
-
|
225
|
-
|
221
|
+
stub_put("/repos/sferik/rails_admin/collaborators/sferik").
|
222
|
+
to_return(:status => 204)
|
223
|
+
result = @client.add_collaborator("sferik/rails_admin", "sferik")
|
224
|
+
result.should == ''
|
226
225
|
end
|
227
226
|
|
228
227
|
end
|
@@ -230,10 +229,10 @@ describe Octokit::Client::Repositories do
|
|
230
229
|
describe ".remove_collaborator" do
|
231
230
|
|
232
231
|
it "should remove a repository collaborators" do
|
233
|
-
|
234
|
-
to_return(:
|
235
|
-
|
236
|
-
|
232
|
+
stub_delete("/repos/sferik/rails_admin/collaborators/sferik").
|
233
|
+
to_return(:status => 204)
|
234
|
+
result = @client.remove_collaborator("sferik/rails_admin", "sferik")
|
235
|
+
result.should == ''
|
237
236
|
end
|
238
237
|
|
239
238
|
end
|
@@ -241,7 +240,7 @@ describe Octokit::Client::Repositories do
|
|
241
240
|
describe ".pushable" do
|
242
241
|
|
243
242
|
it "should return all pushable repositories" do
|
244
|
-
stub_get("/api/v2/json/repos/pushable").
|
243
|
+
stub_get("https://github.com/api/v2/json/repos/pushable").
|
245
244
|
to_return(:body => fixture("v2/repositories.json"))
|
246
245
|
repositories = @client.pushable
|
247
246
|
repositories.first.name.should == "One40Proof"
|
@@ -252,8 +251,8 @@ describe Octokit::Client::Repositories do
|
|
252
251
|
describe ".repository_teams" do
|
253
252
|
|
254
253
|
it "should return all repository teams" do
|
255
|
-
stub_get("/
|
256
|
-
to_return(:body => fixture("
|
254
|
+
stub_get("/repos/codeforamerica/open311/teams").
|
255
|
+
to_return(:body => fixture("v3/teams.json"))
|
257
256
|
teams = @client.repository_teams("codeforamerica/open311")
|
258
257
|
teams.first.name.should == "Fellows"
|
259
258
|
end
|
@@ -265,10 +264,10 @@ describe Octokit::Client::Repositories do
|
|
265
264
|
context "with anonymous users" do
|
266
265
|
|
267
266
|
it "should return all repository contributors" do
|
268
|
-
stub_get("/
|
269
|
-
to_return(:body => fixture("
|
267
|
+
stub_get("/repos/sferik/rails_admin/contributors?anon=true").
|
268
|
+
to_return(:body => fixture("v3/contributors.json"))
|
270
269
|
contributors = @client.contributors("sferik/rails_admin", true)
|
271
|
-
contributors.first.
|
270
|
+
contributors.first.login.should == "sferik"
|
272
271
|
end
|
273
272
|
|
274
273
|
end
|
@@ -276,10 +275,10 @@ describe Octokit::Client::Repositories do
|
|
276
275
|
context "without anonymous users" do
|
277
276
|
|
278
277
|
it "should return all repository contributors" do
|
279
|
-
stub_get("/
|
280
|
-
to_return(:body => fixture("
|
278
|
+
stub_get("/repos/sferik/rails_admin/contributors?anon=false").
|
279
|
+
to_return(:body => fixture("v3/contributors.json"))
|
281
280
|
contributors = @client.contributors("sferik/rails_admin")
|
282
|
-
contributors.first.
|
281
|
+
contributors.first.login.should == "sferik"
|
283
282
|
end
|
284
283
|
|
285
284
|
end
|
@@ -289,10 +288,10 @@ describe Octokit::Client::Repositories do
|
|
289
288
|
describe ".watchers" do
|
290
289
|
|
291
290
|
it "should return all repository watchers" do
|
292
|
-
stub_get("/
|
293
|
-
to_return(:body => fixture("
|
291
|
+
stub_get("/repos/sferik/rails_admin/watchers").
|
292
|
+
to_return(:body => fixture("v3/watchers.json"))
|
294
293
|
watchers = @client.watchers("sferik/rails_admin")
|
295
|
-
watchers.first.should == "sferik"
|
294
|
+
watchers.first.login.should == "sferik"
|
296
295
|
end
|
297
296
|
|
298
297
|
end
|
@@ -300,10 +299,10 @@ describe Octokit::Client::Repositories do
|
|
300
299
|
describe ".network" do
|
301
300
|
|
302
301
|
it "should return a repository's network" do
|
303
|
-
stub_get("/
|
304
|
-
to_return(:body => fixture("
|
302
|
+
stub_get("/repos/sferik/rails_admin/forks").
|
303
|
+
to_return(:body => fixture("v3/forks.json"))
|
305
304
|
network = @client.network("sferik/rails_admin")
|
306
|
-
network.first.owner.should == "
|
305
|
+
network.first.owner.login.should == "digx"
|
307
306
|
end
|
308
307
|
|
309
308
|
end
|
@@ -311,10 +310,10 @@ describe Octokit::Client::Repositories do
|
|
311
310
|
describe ".languages" do
|
312
311
|
|
313
312
|
it "should return a repository's languages" do
|
314
|
-
stub_get("/
|
315
|
-
to_return(:body => fixture("
|
313
|
+
stub_get("/repos/sferik/rails_admin/languages").
|
314
|
+
to_return(:body => fixture("v3/languages.json"))
|
316
315
|
languages = @client.languages("sferik/rails_admin")
|
317
|
-
languages["Ruby"].should ==
|
316
|
+
languages["Ruby"].should == 345701
|
318
317
|
end
|
319
318
|
|
320
319
|
end
|
@@ -322,10 +321,11 @@ describe Octokit::Client::Repositories do
|
|
322
321
|
describe ".tags" do
|
323
322
|
|
324
323
|
it "should return a repository's tags" do
|
325
|
-
stub_get("/
|
326
|
-
to_return(:body => fixture("
|
324
|
+
stub_get("/repos/pengwynn/octokit/tags").
|
325
|
+
to_return(:body => fixture("v3/tags.json"))
|
327
326
|
tags = @client.tags("pengwynn/octokit")
|
328
|
-
tags
|
327
|
+
v0_6_4 = tags.find { |tag| tag.name == "v0.6.4" }
|
328
|
+
v0_6_4.commit.sha.should == "09bcc30e7286eeb1bbde68d0ace7a6b90b1a84a2"
|
329
329
|
end
|
330
330
|
|
331
331
|
end
|
@@ -333,10 +333,11 @@ describe Octokit::Client::Repositories do
|
|
333
333
|
describe ".branches" do
|
334
334
|
|
335
335
|
it "should return a repository's branches" do
|
336
|
-
stub_get("/
|
337
|
-
to_return(:body => fixture("
|
336
|
+
stub_get("/repos/pengwynn/octokit/branches").
|
337
|
+
to_return(:body => fixture("v3/branches.json"))
|
338
338
|
branches = @client.branches("pengwynn/octokit")
|
339
|
-
branches
|
339
|
+
master = branches.find { |branch| branch.name == "master" }
|
340
|
+
master.commit.sha.should == "88553a397f7293b3ba176dc27cd1ab6bb93d5d14"
|
340
341
|
end
|
341
342
|
|
342
343
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require 'helper'
|
3
3
|
|
4
|
-
describe Octokit::Client::
|
4
|
+
describe Octokit::Client::Timelines do
|
5
5
|
|
6
6
|
describe ".timeline" do
|
7
7
|
|
@@ -28,8 +28,8 @@ describe Octokit::Client::Users do
|
|
28
28
|
context "when authenticated" do
|
29
29
|
|
30
30
|
it "should return a user timeline" do
|
31
|
-
client = Octokit::Client.new(:login => "sferik", :
|
32
|
-
stub_get("https://github.com/sferik.private.json
|
31
|
+
client = Octokit::Client.new(:login => "sferik", :password => "sekret")
|
32
|
+
stub_get("https://github.com/sferik.private.json").
|
33
33
|
to_return(:body => fixture("timeline.json"))
|
34
34
|
events = client.user_timeline("sferik")
|
35
35
|
events.first.repository.name.should == "homebrew"
|