octokit 0.6.3 → 0.6.4

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.
Files changed (53) hide show
  1. data/.travis.yml +1 -0
  2. data/CHANGELOG.md +18 -18
  3. data/README.md +5 -3
  4. data/Rakefile +2 -0
  5. data/lib/faraday/response/{raise_error.rb → raise_octokit_error.rb} +11 -2
  6. data/lib/octokit.rb +18 -46
  7. data/lib/octokit/authentication.rb +21 -0
  8. data/lib/octokit/client.rb +13 -6
  9. data/lib/octokit/client/commits.rb +2 -2
  10. data/lib/octokit/client/issues.rb +184 -21
  11. data/lib/octokit/client/milestones.rb +87 -0
  12. data/lib/octokit/client/network.rb +2 -4
  13. data/lib/octokit/client/objects.rb +6 -8
  14. data/lib/octokit/client/organizations.rb +18 -19
  15. data/lib/octokit/client/pub_sub_hubbub.rb +41 -0
  16. data/lib/octokit/client/pub_sub_hubbub/service_hooks.rb +41 -0
  17. data/lib/octokit/client/pulls.rb +12 -3
  18. data/lib/octokit/client/repositories.rb +28 -30
  19. data/lib/octokit/client/timelines.rb +3 -5
  20. data/lib/octokit/client/users.rb +40 -18
  21. data/lib/octokit/connection.rb +42 -0
  22. data/lib/octokit/error.rb +34 -0
  23. data/lib/octokit/request.rb +44 -0
  24. data/lib/octokit/version.rb +1 -1
  25. data/octokit.gemspec +33 -28
  26. data/puppeteer.jpg +0 -0
  27. data/spec/faraday/response_spec.rb +2 -1
  28. data/spec/fixtures/v2/commit.json +1 -1
  29. data/spec/fixtures/v3/comment.json +14 -0
  30. data/spec/fixtures/v3/comments.json +44 -0
  31. data/spec/fixtures/v3/label.json +5 -0
  32. data/spec/fixtures/v3/labels.json +17 -0
  33. data/spec/fixtures/v3/milestone.json +12 -0
  34. data/spec/fixtures/v3/milestones.json +28 -0
  35. data/spec/fixtures/v3/not_found.json +3 -0
  36. data/spec/fixtures/v3/user.json +20 -0
  37. data/spec/helper.rb +14 -11
  38. data/spec/octokit/client/commits_spec.rb +3 -3
  39. data/spec/octokit/client/issues_spec.rb +82 -44
  40. data/spec/octokit/client/milestones_spec.rb +67 -0
  41. data/spec/octokit/client/objects_spec.rb +6 -6
  42. data/spec/octokit/client/organizations_spec.rb +19 -19
  43. data/spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb +45 -0
  44. data/spec/octokit/client/pub_sub_hubbub_spec.rb +49 -0
  45. data/spec/octokit/client/pulls_spec.rb +15 -3
  46. data/spec/octokit/client/repositories_spec.rb +30 -30
  47. data/spec/octokit/client/users_spec.rb +26 -26
  48. data/spec/octokit/client_spec.rb +2 -2
  49. data/spec/octokit_spec.rb +12 -3
  50. metadata +147 -55
  51. data/lib/octokit/client/authentication.rb +0 -23
  52. data/lib/octokit/client/connection.rb +0 -33
  53. data/lib/octokit/client/request.rb +0 -42
@@ -10,7 +10,7 @@ describe Octokit::Client::Organizations do
10
10
  describe ".organization" do
11
11
 
12
12
  it "should return an organization" do
13
- stub_get("organizations/codeforamerica").
13
+ stub_get("/api/v2/json/organizations/codeforamerica").
14
14
  to_return(:body => fixture("v2/organization.json"))
15
15
  organization = @client.organization("codeforamerica")
16
16
  organization.name.should == "Code For America"
@@ -21,7 +21,7 @@ describe Octokit::Client::Organizations do
21
21
  describe ".update_organization" do
22
22
 
23
23
  it "should update an organization" do
24
- stub_put("organizations/codeforamerica").
24
+ stub_put("/api/v2/json/organizations/codeforamerica").
25
25
  with(:name => "Code For America").
26
26
  to_return(:body => fixture("v2/organization.json"))
27
27
  organization = @client.update_organization("codeforamerica", {:name => "Code For America"})
@@ -35,7 +35,7 @@ describe Octokit::Client::Organizations do
35
35
  context "with an org passed" do
36
36
 
37
37
  it "should return all organizations for a user" do
38
- stub_get("user/show/sferik/organizations").
38
+ stub_get("/api/v2/json/user/show/sferik/organizations").
39
39
  to_return(:body => fixture("v2/organizations.json"))
40
40
  organizations = @client.organizations("sferik")
41
41
  organizations.first.name.should == "Hubcap"
@@ -46,7 +46,7 @@ describe Octokit::Client::Organizations do
46
46
  context "without an org passed" do
47
47
 
48
48
  it "should return all organizations for a user" do
49
- stub_get("organizations").
49
+ stub_get("/api/v2/json/organizations").
50
50
  to_return(:body => fixture("v2/organizations.json"))
51
51
  organizations = @client.organizations
52
52
  organizations.first.name.should == "Hubcap"
@@ -61,7 +61,7 @@ describe Octokit::Client::Organizations do
61
61
  context "with an org passed" do
62
62
 
63
63
  it "should return all public repositories for an organization" do
64
- stub_get("organizations/codeforamerica/public_repositories").
64
+ stub_get("/api/v2/json/organizations/codeforamerica/public_repositories").
65
65
  to_return(:body => fixture("v2/repositories.json"))
66
66
  repositories = @client.organization_repositories("codeforamerica")
67
67
  repositories.first.name.should == "One40Proof"
@@ -72,7 +72,7 @@ describe Octokit::Client::Organizations do
72
72
  context "without an org passed" do
73
73
 
74
74
  it "should return all organization repositories for a user" do
75
- stub_get("organizations/repositories").
75
+ stub_get("/api/v2/json/organizations/repositories").
76
76
  to_return(:body => fixture("v2/repositories.json"))
77
77
  repositories = @client.organization_repositories
78
78
  repositories.first.name.should == "One40Proof"
@@ -85,7 +85,7 @@ describe Octokit::Client::Organizations do
85
85
  describe ".organization_members" do
86
86
 
87
87
  it "should return all public members of an organization" do
88
- stub_get("organizations/codeforamerica/public_members").
88
+ stub_get("/api/v2/json/organizations/codeforamerica/public_members").
89
89
  to_return(:body => fixture("v2/users.json"))
90
90
  users = @client.organization_members("codeforamerica")
91
91
  users.first.name.should == "Erik Michaels-Ober"
@@ -96,7 +96,7 @@ describe Octokit::Client::Organizations do
96
96
  describe ".organization_teams" do
97
97
 
98
98
  it "should return all teams for an organization" do
99
- stub_get("organizations/codeforamerica/teams").
99
+ stub_get("/api/v2/json/organizations/codeforamerica/teams").
100
100
  to_return(:body => fixture("v2/teams.json"))
101
101
  teams = @client.organization_teams("codeforamerica")
102
102
  teams.first.name.should == "Fellows"
@@ -107,7 +107,7 @@ describe Octokit::Client::Organizations do
107
107
  describe ".create_team" do
108
108
 
109
109
  it "should create a team" do
110
- stub_post("organizations/codeforamerica/teams").
110
+ stub_post("/api/v2/json/organizations/codeforamerica/teams").
111
111
  with(:name => "Fellows").
112
112
  to_return(:body => fixture("v2/team.json"))
113
113
  team = @client.create_team("codeforamerica", {:name => "Fellows"})
@@ -119,7 +119,7 @@ describe Octokit::Client::Organizations do
119
119
  describe ".team" do
120
120
 
121
121
  it "should return a team" do
122
- stub_get("teams/32598").
122
+ stub_get("/api/v2/json/teams/32598").
123
123
  to_return(:body => fixture("v2/team.json"))
124
124
  team = @client.team(32598)
125
125
  team.name.should == "Fellows"
@@ -130,7 +130,7 @@ describe Octokit::Client::Organizations do
130
130
  describe ".update_team" do
131
131
 
132
132
  it "should update a team" do
133
- stub_put("teams/32598").
133
+ stub_put("/api/v2/json/teams/32598").
134
134
  with(:name => "Fellows").
135
135
  to_return(:body => fixture("v2/team.json"))
136
136
  team = @client.update_team(32598, :name => "Fellows")
@@ -142,7 +142,7 @@ describe Octokit::Client::Organizations do
142
142
  describe ".delete_team" do
143
143
 
144
144
  it "should delete a team" do
145
- stub_delete("teams/32598").
145
+ stub_delete("/api/v2/json/teams/32598").
146
146
  to_return(:body => fixture("v2/team.json"))
147
147
  team = @client.delete_team(32598)
148
148
  team.name.should == "Fellows"
@@ -153,7 +153,7 @@ describe Octokit::Client::Organizations do
153
153
  describe ".delete_team" do
154
154
 
155
155
  it "should delete a team" do
156
- stub_delete("teams/32598").
156
+ stub_delete("/api/v2/json/teams/32598").
157
157
  to_return(:body => fixture("v2/team.json"))
158
158
  team = @client.delete_team(32598)
159
159
  team.name.should == "Fellows"
@@ -164,7 +164,7 @@ describe Octokit::Client::Organizations do
164
164
  describe ".team_members" do
165
165
 
166
166
  it "should return team members" do
167
- stub_get("teams/32598/members").
167
+ stub_get("/api/v2/json/teams/32598/members").
168
168
  to_return(:body => fixture("v2/users.json"))
169
169
  users = @client.team_members(32598)
170
170
  users.first.name.should == "Erik Michaels-Ober"
@@ -175,7 +175,7 @@ describe Octokit::Client::Organizations do
175
175
  describe ".add_team_member" do
176
176
 
177
177
  it "should add a team member" do
178
- stub_post("teams/32598/members").
178
+ stub_post("/api/v2/json/teams/32598/members").
179
179
  with(:name => "sferik").
180
180
  to_return(:body => fixture("v2/user.json"))
181
181
  user = @client.add_team_member(32598, "sferik")
@@ -187,7 +187,7 @@ describe Octokit::Client::Organizations do
187
187
  describe ".remove_team_member" do
188
188
 
189
189
  it "should remove a team member" do
190
- stub_delete("teams/32598/members").
190
+ stub_delete("/api/v2/json/teams/32598/members").
191
191
  with(:query => {:name => "sferik"}).
192
192
  to_return(:body => fixture("v2/user.json"))
193
193
  user = @client.remove_team_member(32598, "sferik")
@@ -199,7 +199,7 @@ describe Octokit::Client::Organizations do
199
199
  describe ".team_repositories" do
200
200
 
201
201
  it "should return team repositories" do
202
- stub_get("teams/32598/repositories").
202
+ stub_get("/api/v2/json/teams/32598/repositories").
203
203
  to_return(:body => fixture("v2/repositories.json"))
204
204
  repositories = @client.team_repositories(32598)
205
205
  repositories.first.name.should == "One40Proof"
@@ -210,7 +210,7 @@ describe Octokit::Client::Organizations do
210
210
  describe ".add_team_repository" do
211
211
 
212
212
  it "should add a team repository" do
213
- stub_post("teams/32598/repositories").
213
+ stub_post("/api/v2/json/teams/32598/repositories").
214
214
  with(:name => "reddavis/One40Proof").
215
215
  to_return(:body => fixture("v2/repositories.json"))
216
216
  repositories = @client.add_team_repository(32598, "reddavis/One40Proof")
@@ -222,7 +222,7 @@ describe Octokit::Client::Organizations do
222
222
  describe ".remove_team_repository" do
223
223
 
224
224
  it "should remove a team repository" do
225
- stub_delete("teams/32598/repositories").
225
+ stub_delete("/api/v2/json/teams/32598/repositories").
226
226
  with(:query => {:name => "reddavis/One40Proof"}).
227
227
  to_return(:body => fixture("v2/repositories.json"))
228
228
  repositories = @client.remove_team_repository(32598, "reddavis/One40Proof")
@@ -0,0 +1,45 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ describe Octokit::Client::PubSubHubbub::ServiceHooks do
5
+
6
+ let(:client) { Octokit::Client.new(:oauth_token => 'myfaketoken') }
7
+
8
+ describe "subscribe_service_hook" do
9
+ let(:subscribe_request_body) {
10
+ {
11
+ :"hub.callback" => 'github://Travis?token=travistoken',
12
+ :"hub.mode" => 'subscribe',
13
+ :"hub.topic" => 'https://github.com/joshk/completeness-fu/events/push'
14
+ }
15
+ }
16
+ it "subscribes to pull events on specified topic" do
17
+ stub_post("https://api.github.com/hub?access_token=myfaketoken").
18
+ with(subscribe_request_body).
19
+ to_return(:body => nil)
20
+
21
+ client.subscribe_service_hook("joshk/completeness-fu", "Travis", { :token => 'travistoken' }).should == true
22
+ assert_requested :post, "https://api.github.com/hub?access_token=myfaketoken", :body => subscribe_request_body, :times => 1
23
+ end
24
+ end
25
+
26
+ describe "unsubscribe_service_hook" do
27
+ let(:unsubscribe_request_body) {
28
+ {
29
+ :"hub.callback" => 'github://Travis',
30
+ :"hub.mode" => 'unsubscribe',
31
+ :"hub.topic" => 'https://github.com/joshk/completeness-fu/events/push'
32
+ }
33
+ }
34
+
35
+ it "unsubscribes to stop receiving events on specified topic" do
36
+ stub_post("https://api.github.com/hub?access_token=myfaketoken").
37
+ with(unsubscribe_request_body).
38
+ to_return(:body => nil)
39
+
40
+ client.unsubscribe_service_hook("joshk/completeness-fu", "Travis").should == true
41
+ assert_requested :post, "https://api.github.com/hub?access_token=myfaketoken", :body => unsubscribe_request_body, :times => 1
42
+ end
43
+ end
44
+ end
45
+
@@ -0,0 +1,49 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ describe Octokit::Client::PubSubHubbub do
5
+ let(:client) { Octokit::Client.new(:oauth_token => 'myfaketoken') }
6
+
7
+ describe ".subscribe" do
8
+ it "subscribes to pull events" do
9
+ stub_post("https://api.github.com/hub?access_token=myfaketoken").
10
+ with({
11
+ :"hub.callback" => 'github://Travis?token=travistoken',
12
+ :"hub.mode" => 'subscribe',
13
+ :"hub.topic" => 'https://github.com/joshk/completeness-fu/events/push'
14
+ }).
15
+ to_return(:body => nil)
16
+
17
+ client.subscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken").should == true
18
+ end
19
+
20
+ it "raises an error if the topic is not recognized" do
21
+ stub_post("https://api.github.com/hub?access_token=myfaketoken").
22
+ with({
23
+ :"hub.callback" => 'github://Travis?token=travistoken',
24
+ :"hub.mode" => 'subscribe',
25
+ :"hub.topic" => 'https://github.com/joshk/completeness-fud/events/push'
26
+ }).
27
+ to_return(:status => 422)
28
+
29
+ proc {
30
+ client.subscribe("https://github.com/joshk/completeness-fud/events/push", "github://Travis?token=travistoken")
31
+ }.should raise_exception
32
+ end
33
+ end
34
+
35
+ describe ".unsubscribe" do
36
+ it "unsubscribes from pull events" do
37
+ stub_post("https://api.github.com/hub?access_token=myfaketoken").
38
+ with({
39
+ :"hub.callback" => 'github://Travis?token=travistoken',
40
+ :"hub.mode" => 'unsubscribe',
41
+ :"hub.topic" => 'https://github.com/joshk/completeness-fu/events/push'
42
+ }).
43
+ to_return(:body => nil)
44
+
45
+ client.unsubscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken").should == true
46
+ end
47
+ end
48
+
49
+ end
@@ -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("pulls/sferik/rails_admin").
13
+ stub_post("/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")
@@ -19,10 +19,22 @@ describe Octokit::Client::Pulls do
19
19
 
20
20
  end
21
21
 
22
+ describe ".create_pull_request_for_issue" do
23
+
24
+ it "should create a pull request and attach it to an existing issue" do
25
+ stub_post("/api/v2/json/pulls/pengwynn/octokit").
26
+ with(:pull => {:base => "master", :head => "pengwynn:master", :issue => "34"}).
27
+ to_return(:body => fixture("v2/pulls.json"))
28
+ issues = @client.create_pull_request_for_issue("pengwynn/octokit", "master", "pengwynn:master", "34")
29
+ issues.first.number.should == 251
30
+ end
31
+
32
+ end
33
+
22
34
  describe ".pull_requests" do
23
35
 
24
36
  it "should return all pull requests" do
25
- stub_get("pulls/sferik/rails_admin/open").
37
+ stub_get("/api/v2/json/pulls/sferik/rails_admin/open").
26
38
  to_return(:body => fixture("v2/pulls.json"))
27
39
  pulls = @client.pulls("sferik/rails_admin")
28
40
  pulls.first.number.should == 251
@@ -33,7 +45,7 @@ describe Octokit::Client::Pulls do
33
45
  describe ".pull_request" do
34
46
 
35
47
  it "should return a pull request" do
36
- stub_get("pulls/sferik/rails_admin/251").
48
+ stub_get("/api/v2/json/pulls/sferik/rails_admin/251").
37
49
  to_return(:body => fixture("v2/pull.json"))
38
50
  pull = @client.pull("sferik/rails_admin", 251)
39
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("repos/search/One40Proof").
13
+ stub_get("/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,7 +21,7 @@ describe Octokit::Client::Repositories do
21
21
  describe ".repository" do
22
22
 
23
23
  it "should return the matching repository" do
24
- stub_get("repos/show/sferik/rails_admin").
24
+ stub_get("/api/v2/json/repos/show/sferik/rails_admin").
25
25
  to_return(:body => fixture("v2/repository.json"))
26
26
  repository = @client.repository("sferik/rails_admin")
27
27
  repository.name.should == "rails_admin"
@@ -33,7 +33,7 @@ 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
- stub_post("repos/show/sferik/rails_admin").
36
+ stub_post("/api/v2/json/repos/show/sferik/rails_admin").
37
37
  with(:values => {:description => description}).
38
38
  to_return(:body => fixture("v2/repository.json"))
39
39
  repository = @client.update_repository("sferik/rails_admin", :description => description)
@@ -47,7 +47,7 @@ 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("repos/show/sferik").
50
+ stub_get("/api/v2/json/repos/show/sferik").
51
51
  to_return(:body => fixture("v2/repositories.json"))
52
52
  repositories = @client.repositories("sferik")
53
53
  repositories.first.name.should == "One40Proof"
@@ -58,7 +58,7 @@ 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("repos/show/sferik").
61
+ stub_get("/api/v2/json/repos/show/sferik").
62
62
  to_return(:body => fixture("v2/repositories.json"))
63
63
  repositories = @client.repositories
64
64
  repositories.first.name.should == "One40Proof"
@@ -71,7 +71,7 @@ describe Octokit::Client::Repositories do
71
71
  describe ".watch" do
72
72
 
73
73
  it "should watch a repository" do
74
- stub_post("repos/watch/sferik/rails_admin").
74
+ stub_post("/api/v2/json/repos/watch/sferik/rails_admin").
75
75
  to_return(:body => fixture("v2/repository.json"))
76
76
  repository = @client.watch("sferik/rails_admin")
77
77
  repository.name.should == "rails_admin"
@@ -82,7 +82,7 @@ describe Octokit::Client::Repositories do
82
82
  describe ".unwatch" do
83
83
 
84
84
  it "should unwatch a repository" do
85
- stub_post("repos/unwatch/sferik/rails_admin").
85
+ stub_post("/api/v2/json/repos/unwatch/sferik/rails_admin").
86
86
  to_return(:body => fixture("v2/repository.json"))
87
87
  repository = @client.unwatch("sferik/rails_admin")
88
88
  repository.name.should == "rails_admin"
@@ -93,7 +93,7 @@ describe Octokit::Client::Repositories do
93
93
  describe ".fork" do
94
94
 
95
95
  it "should fork a repository" do
96
- stub_post("repos/fork/sferik/rails_admin").
96
+ stub_post("/api/v2/json/repos/fork/sferik/rails_admin").
97
97
  to_return(:body => fixture("v2/repository.json"))
98
98
  repository = @client.fork("sferik/rails_admin")
99
99
  repository.name.should == "rails_admin"
@@ -104,7 +104,7 @@ describe Octokit::Client::Repositories do
104
104
  describe ".create_repository" do
105
105
 
106
106
  it "should create a repository" do
107
- stub_post("repos/create").
107
+ stub_post("/api/v2/json/repos/create").
108
108
  with(:name => "rails_admin").
109
109
  to_return(:body => fixture("v2/repository.json"))
110
110
  repository = @client.create_repository("rails_admin")
@@ -116,7 +116,7 @@ describe Octokit::Client::Repositories do
116
116
  describe ".delete_repository" do
117
117
 
118
118
  it "should return a delete token" do
119
- stub_post("repos/delete/sferik/rails_admin").
119
+ stub_post("/api/v2/json/repos/delete/sferik/rails_admin").
120
120
  to_return(:body => fixture("v2/delete_token.json"))
121
121
  delete_token = @client.delete_repository("sferik/rails_admin")
122
122
  delete_token.should == "uhihwkkkzu"
@@ -127,9 +127,9 @@ describe Octokit::Client::Repositories do
127
127
  describe ".delete_repository!" do
128
128
 
129
129
  it "should delete a repository" do
130
- stub_post("repos/delete/sferik/rails_admin").
130
+ stub_post("/api/v2/json/repos/delete/sferik/rails_admin").
131
131
  to_return(:body => fixture("v2/delete_token.json"))
132
- stub_post("repos/delete/sferik/rails_admin").
132
+ stub_post("/api/v2/json/repos/delete/sferik/rails_admin").
133
133
  with(:delete_token => "uhihwkkkzu").
134
134
  to_return(:status => 204)
135
135
  @client.delete_repo!("sferik/rails_admin")
@@ -140,7 +140,7 @@ describe Octokit::Client::Repositories do
140
140
  describe ".delete_repository" do
141
141
 
142
142
  it "should return an error for non-existant repo" do
143
- stub_post("repos/delete/sferik/rails_admin_failure").
143
+ stub_post("/api/v2/json/repos/delete/sferik/rails_admin_failure").
144
144
  to_return(:body => fixture("v2/delete_failure.json"))
145
145
  response = @client.delete_repository("sferik/rails_admin_failure")
146
146
  response.error.should == "sferik/rails_admin_failure Repository not found"
@@ -151,7 +151,7 @@ describe Octokit::Client::Repositories do
151
151
  describe ".set_private" do
152
152
 
153
153
  it "should set a repository private" do
154
- stub_post("repos/set/private/sferik/rails_admin").
154
+ stub_post("/api/v2/json/repos/set/private/sferik/rails_admin").
155
155
  to_return(:body => fixture("v2/repository.json"))
156
156
  repository = @client.set_private("sferik/rails_admin")
157
157
  repository.name.should == "rails_admin"
@@ -162,7 +162,7 @@ describe Octokit::Client::Repositories do
162
162
  describe ".set_public" do
163
163
 
164
164
  it "should set a repository public" do
165
- stub_post("repos/set/public/sferik/rails_admin").
165
+ stub_post("/api/v2/json/repos/set/public/sferik/rails_admin").
166
166
  to_return(:body => fixture("v2/repository.json"))
167
167
  repository = @client.set_public("sferik/rails_admin")
168
168
  repository.name.should == "rails_admin"
@@ -173,7 +173,7 @@ 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("repos/keys/sferik/rails_admin").
176
+ stub_get("/api/v2/json/repos/keys/sferik/rails_admin").
177
177
  to_return(:body => fixture("v2/public_keys.json"))
178
178
  public_keys = @client.deploy_keys("sferik/rails_admin")
179
179
  public_keys.first.id.should == 103205
@@ -184,7 +184,7 @@ 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("repos/key/sferik/rails_admin/add").
187
+ stub_post("/api/v2/json/repos/key/sferik/rails_admin/add").
188
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
189
  to_return(:body => fixture("v2/public_keys.json"))
190
190
  public_keys = @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")
@@ -196,7 +196,7 @@ 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
- stub_post("repos/key/sferik/rails_admin/remove").
199
+ stub_post("/api/v2/json/repos/key/sferik/rails_admin/remove").
200
200
  with(:id => 103205).
201
201
  to_return(:body => fixture("v2/public_keys.json"))
202
202
  public_keys = @client.remove_deploy_key("sferik/rails_admin", 103205)
@@ -208,7 +208,7 @@ describe Octokit::Client::Repositories do
208
208
  describe ".collaborators" do
209
209
 
210
210
  it "should return a repository's collaborators" do
211
- stub_get("repos/show/sferik/rails_admin/collaborators").
211
+ stub_get("/api/v2/json/repos/show/sferik/rails_admin/collaborators").
212
212
  to_return(:body => fixture("v2/collaborators.json"))
213
213
  collaborators = @client.collaborators("sferik/rails_admin")
214
214
  collaborators.first.should == "sferik"
@@ -219,7 +219,7 @@ describe Octokit::Client::Repositories do
219
219
  describe ".add_collaborator" do
220
220
 
221
221
  it "should add a repository collaborators" do
222
- stub_post("repos/collaborators/sferik/rails_admin/add/sferik").
222
+ stub_post("/api/v2/json/repos/collaborators/sferik/rails_admin/add/sferik").
223
223
  to_return(:body => fixture("v2/collaborators.json"))
224
224
  collaborators = @client.add_collaborator("sferik/rails_admin", "sferik")
225
225
  collaborators.first.should == "sferik"
@@ -230,7 +230,7 @@ describe Octokit::Client::Repositories do
230
230
  describe ".remove_collaborator" do
231
231
 
232
232
  it "should remove a repository collaborators" do
233
- stub_post("repos/collaborators/sferik/rails_admin/remove/sferik").
233
+ stub_post("/api/v2/json/repos/collaborators/sferik/rails_admin/remove/sferik").
234
234
  to_return(:body => fixture("v2/collaborators.json"))
235
235
  collaborators = @client.remove_collaborator("sferik/rails_admin", "sferik")
236
236
  collaborators.first.should == "sferik"
@@ -241,7 +241,7 @@ describe Octokit::Client::Repositories do
241
241
  describe ".pushable" do
242
242
 
243
243
  it "should return all pushable repositories" do
244
- stub_get("repos/pushable").
244
+ stub_get("/api/v2/json/repos/pushable").
245
245
  to_return(:body => fixture("v2/repositories.json"))
246
246
  repositories = @client.pushable
247
247
  repositories.first.name.should == "One40Proof"
@@ -252,7 +252,7 @@ describe Octokit::Client::Repositories do
252
252
  describe ".repository_teams" do
253
253
 
254
254
  it "should return all repository teams" do
255
- stub_get("repos/show/codeforamerica/open311/teams").
255
+ stub_get("/api/v2/json/repos/show/codeforamerica/open311/teams").
256
256
  to_return(:body => fixture("v2/teams.json"))
257
257
  teams = @client.repository_teams("codeforamerica/open311")
258
258
  teams.first.name.should == "Fellows"
@@ -265,7 +265,7 @@ describe Octokit::Client::Repositories do
265
265
  context "with anonymous users" do
266
266
 
267
267
  it "should return all repository contributors" do
268
- stub_get("repos/show/sferik/rails_admin/contributors/anon").
268
+ stub_get("/api/v2/json/repos/show/sferik/rails_admin/contributors/anon").
269
269
  to_return(:body => fixture("v2/contributors.json"))
270
270
  contributors = @client.contributors("sferik/rails_admin", true)
271
271
  contributors.first.name.should == "Erik Michaels-Ober"
@@ -276,7 +276,7 @@ describe Octokit::Client::Repositories do
276
276
  context "without anonymous users" do
277
277
 
278
278
  it "should return all repository contributors" do
279
- stub_get("repos/show/sferik/rails_admin/contributors").
279
+ stub_get("/api/v2/json/repos/show/sferik/rails_admin/contributors").
280
280
  to_return(:body => fixture("v2/contributors.json"))
281
281
  contributors = @client.contributors("sferik/rails_admin")
282
282
  contributors.first.name.should == "Erik Michaels-Ober"
@@ -289,7 +289,7 @@ describe Octokit::Client::Repositories do
289
289
  describe ".watchers" do
290
290
 
291
291
  it "should return all repository watchers" do
292
- stub_get("repos/show/sferik/rails_admin/watchers").
292
+ stub_get("/api/v2/json/repos/show/sferik/rails_admin/watchers").
293
293
  to_return(:body => fixture("v2/watchers.json"))
294
294
  watchers = @client.watchers("sferik/rails_admin")
295
295
  watchers.first.should == "sferik"
@@ -300,7 +300,7 @@ describe Octokit::Client::Repositories do
300
300
  describe ".network" do
301
301
 
302
302
  it "should return a repository's network" do
303
- stub_get("repos/show/sferik/rails_admin/network").
303
+ stub_get("/api/v2/json/repos/show/sferik/rails_admin/network").
304
304
  to_return(:body => fixture("v2/network.json"))
305
305
  network = @client.network("sferik/rails_admin")
306
306
  network.first.owner.should == "sferik"
@@ -311,7 +311,7 @@ describe Octokit::Client::Repositories do
311
311
  describe ".languages" do
312
312
 
313
313
  it "should return a repository's languages" do
314
- stub_get("repos/show/sferik/rails_admin/languages").
314
+ stub_get("/api/v2/json/repos/show/sferik/rails_admin/languages").
315
315
  to_return(:body => fixture("v2/languages.json"))
316
316
  languages = @client.languages("sferik/rails_admin")
317
317
  languages["Ruby"].should == 205046
@@ -322,7 +322,7 @@ describe Octokit::Client::Repositories do
322
322
  describe ".tags" do
323
323
 
324
324
  it "should return a repository's tags" do
325
- stub_get("repos/show/pengwynn/octokit/tags").
325
+ stub_get("/api/v2/json/repos/show/pengwynn/octokit/tags").
326
326
  to_return(:body => fixture("v2/tags.json"))
327
327
  tags = @client.tags("pengwynn/octokit")
328
328
  tags["v0.0.1"].should == "0d7a03f2035ecd74e4d6eb9be58865c2a688ee55"
@@ -333,7 +333,7 @@ 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("repos/show/pengwynn/octokit/branches").
336
+ stub_get("/api/v2/json/repos/show/pengwynn/octokit/branches").
337
337
  to_return(:body => fixture("v2/branches.json"))
338
338
  branches = @client.branches("pengwynn/octokit")
339
339
  branches["master"].should == "4d9a9e9ca183bab1c3d0accf1d53edd85bd6200f"