octokit 0.6.2 → 0.6.3

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 (71) hide show
  1. data/.travis.yml +3 -2
  2. data/CHANGELOG.md +20 -0
  3. data/Gemfile +5 -1
  4. data/README.md +67 -0
  5. data/lib/faraday/response/raise_error.rb +1 -1
  6. data/lib/octokit/client/commits.rb +2 -2
  7. data/lib/octokit/client/connection.rb +5 -7
  8. data/lib/octokit/client/issues.rb +19 -19
  9. data/lib/octokit/client/network.rb +2 -2
  10. data/lib/octokit/client/objects.rb +6 -6
  11. data/lib/octokit/client/organizations.rb +18 -18
  12. data/lib/octokit/client/pulls.rb +3 -3
  13. data/lib/octokit/client/repositories.rb +29 -29
  14. data/lib/octokit/client/request.rb +20 -19
  15. data/lib/octokit/client/timelines.rb +5 -5
  16. data/lib/octokit/client/users.rb +15 -15
  17. data/lib/octokit/configuration.rb +4 -15
  18. data/lib/octokit/version.rb +1 -1
  19. data/octokit.gemspec +14 -14
  20. data/spec/fixtures/{blob.json → v2/blob.json} +0 -0
  21. data/spec/fixtures/{blob_metadata.json → v2/blob_metadata.json} +0 -0
  22. data/spec/fixtures/{blobs.json → v2/blobs.json} +0 -0
  23. data/spec/fixtures/{branches.json → v2/branches.json} +0 -0
  24. data/spec/fixtures/{collaborators.json → v2/collaborators.json} +0 -0
  25. data/spec/fixtures/{comment.json → v2/comment.json} +0 -0
  26. data/spec/fixtures/{comments.json → v2/comments.json} +0 -0
  27. data/spec/fixtures/{commit.json → v2/commit.json} +0 -0
  28. data/spec/fixtures/{commits.json → v2/commits.json} +0 -0
  29. data/spec/fixtures/{contributors.json → v2/contributors.json} +0 -0
  30. data/spec/fixtures/v2/delete_failure.json +1 -0
  31. data/spec/fixtures/{delete_token.json → v2/delete_token.json} +0 -0
  32. data/spec/fixtures/{emails.json → v2/emails.json} +0 -0
  33. data/spec/fixtures/{followers.json → v2/followers.json} +0 -0
  34. data/spec/fixtures/{following.json → v2/following.json} +0 -0
  35. data/spec/fixtures/{issue.json → v2/issue.json} +0 -0
  36. data/spec/fixtures/{issues.json → v2/issues.json} +0 -0
  37. data/spec/fixtures/{labels.json → v2/labels.json} +0 -0
  38. data/spec/fixtures/{languages.json → v2/languages.json} +0 -0
  39. data/spec/fixtures/{network.json → v2/network.json} +0 -0
  40. data/spec/fixtures/{network_data.json → v2/network_data.json} +0 -0
  41. data/spec/fixtures/{network_meta.json → v2/network_meta.json} +0 -0
  42. data/spec/fixtures/{organization.json → v2/organization.json} +0 -0
  43. data/spec/fixtures/{organizations.json → v2/organizations.json} +0 -0
  44. data/spec/fixtures/{public_keys.json → v2/public_keys.json} +0 -0
  45. data/spec/fixtures/{pull.json → v2/pull.json} +0 -0
  46. data/spec/fixtures/{pulls.json → v2/pulls.json} +0 -0
  47. data/spec/fixtures/{raw.txt → v2/raw.txt} +0 -0
  48. data/spec/fixtures/{repositories.json → v2/repositories.json} +0 -0
  49. data/spec/fixtures/{repository.json → v2/repository.json} +0 -0
  50. data/spec/fixtures/{tags.json → v2/tags.json} +0 -0
  51. data/spec/fixtures/{team.json → v2/team.json} +0 -0
  52. data/spec/fixtures/{teams.json → v2/teams.json} +0 -0
  53. data/spec/fixtures/{tree.json → v2/tree.json} +0 -0
  54. data/spec/fixtures/{tree_metadata.json → v2/tree_metadata.json} +0 -0
  55. data/spec/fixtures/{user.json → v2/user.json} +0 -0
  56. data/spec/fixtures/{users.json → v2/users.json} +0 -0
  57. data/spec/fixtures/{watchers.json → v2/watchers.json} +0 -0
  58. data/spec/fixtures/v3/issues.json +1580 -0
  59. data/spec/helper.rb +3 -3
  60. data/spec/octokit/client/commits_spec.rb +2 -2
  61. data/spec/octokit/client/issues_spec.rb +25 -26
  62. data/spec/octokit/client/network_spec.rb +2 -2
  63. data/spec/octokit/client/objects_spec.rb +6 -9
  64. data/spec/octokit/client/organizations_spec.rb +19 -19
  65. data/spec/octokit/client/pulls_spec.rb +3 -3
  66. data/spec/octokit/client/repositories_spec.rb +44 -31
  67. data/spec/octokit/client/users_spec.rb +21 -21
  68. data/spec/octokit/client_spec.rb +8 -7
  69. metadata +110 -96
  70. data/README.markdown +0 -73
  71. data/changelog.markdown +0 -42
@@ -55,10 +55,10 @@ def github_url(url)
55
55
  if url =~ /^http/
56
56
  url
57
57
  elsif @client && @client.authenticated?
58
- "https://pengwynn%2Ftoken:OU812@github.com/api/v#{Octokit.version}/#{Octokit.format}/#{url}"
58
+ "https://pengwynn%2Ftoken:OU812@github.com/api/v2/json/#{url}"
59
59
  elsif @client && @client.oauthed?
60
- "https://github.com/api/v#{Octokit.version}/#{Octokit.format}/#{url}?access_token=#{@client.oauth_token}"
60
+ "https://github.com/api/v2/json/#{url}?access_token=#{@client.oauth_token}"
61
61
  else
62
- "https://github.com/api/v#{Octokit.version}/#{Octokit.format}/#{url}"
62
+ "https://github.com/api/v2/json/#{url}"
63
63
  end
64
64
  end
@@ -11,7 +11,7 @@ describe Octokit::Client::Pulls do
11
11
 
12
12
  it "should return all commits" do
13
13
  stub_get("commits/list/sferik/rails_admin/master").
14
- to_return(:body => fixture("commits.json"))
14
+ to_return(:body => fixture("v2/commits.json"))
15
15
  commits = @client.commits("sferik/rails_admin")
16
16
  commits.first.author.login.should == "caboteria"
17
17
  end
@@ -22,7 +22,7 @@ describe Octokit::Client::Pulls do
22
22
 
23
23
  it "should return a commit" do
24
24
  stub_get("commits/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
25
- to_return(:body => fixture("commit.json"))
25
+ to_return(:body => fixture("v2/commit.json"))
26
26
  commit = @client.commit("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
27
27
  commit.first.author.login.should == "caboteria"
28
28
  end
@@ -11,18 +11,19 @@ describe Octokit::Client::Issues do
11
11
 
12
12
  it "should return matching issues" do
13
13
  stub_get("issues/search/sferik/rails_admin/open/activerecord").
14
- to_return(:body => fixture("issues.json"))
14
+ to_return(:body => fixture("v2/issues.json"))
15
15
  issues = @client.search_issues("sferik/rails_admin", "activerecord")
16
16
  issues.first.number.should == 105
17
17
  end
18
18
 
19
19
  end
20
20
 
21
- describe ".issues" do
21
+ describe ".list_issues" do
22
22
 
23
23
  it "should return issues" do
24
- stub_get("issues/list/sferik/rails_admin/open").
25
- to_return(:body => fixture("issues.json"))
24
+
25
+ stub_get("https://github.com/api/v2/json/issues/list/sferik/rails_admin/open").
26
+ to_return(:body => fixture("v2/issues.json"))
26
27
  issues = @client.issues("sferik/rails_admin")
27
28
  issues.first.number.should == 105
28
29
  end
@@ -30,13 +31,22 @@ describe Octokit::Client::Issues do
30
31
  end
31
32
 
32
33
  describe ".issues_labeled" do
33
-
34
34
  it "should return issues with a particular label" do
35
35
  stub_get("issues/list/sferik/rails_admin/label/bug").
36
- to_return(:body => fixture("issues.json"))
36
+ to_return(:body => fixture("v2/issues.json"))
37
37
  issues = @client.issues_labeled("sferik/rails_admin", "bug")
38
38
  issues.first.number.should == 105
39
39
  end
40
+ end
41
+
42
+ describe ".create_issue" do
43
+
44
+ it "should create an issue" do
45
+ stub_post("issues/open/sferik/rails_admin").
46
+ to_return(:body => fixture("v2/issue.json"))
47
+ issue = @client.create_issue("sferik/rails_admin", "Use OrmAdapter instead of talking directly to ActiveRecord", "Hi,\n\nI just tried to play with this in an app with no ActiveRecord. I was disappointed. It seems the only reason the engine relies on AR is to provide History functionality. I would argue that having the History in a database, and therefore tying the app to AR & SQL, isn't worth it. How about we change it to just dump to a CSV and remove the AR dep?\n\n$0.02")
48
+ issue.number.should == 105
49
+ end
40
50
 
41
51
  end
42
52
 
@@ -44,7 +54,7 @@ describe Octokit::Client::Issues do
44
54
 
45
55
  it "should return an issue" do
46
56
  stub_get("issues/show/sferik/rails_admin/105").
47
- to_return(:body => fixture("issue.json"))
57
+ to_return(:body => fixture("v2/issue.json"))
48
58
  issue = @client.issue("sferik/rails_admin", 105)
49
59
  issue.number.should == 105
50
60
  end
@@ -55,29 +65,18 @@ describe Octokit::Client::Issues do
55
65
 
56
66
  it "should return comments for an issue" do
57
67
  stub_get("issues/comments/sferik/rails_admin/105").
58
- to_return(:body => fixture("comments.json"))
68
+ to_return(:body => fixture("v2/comments.json"))
59
69
  comments = @client.issue_comments("sferik/rails_admin", 105)
60
70
  comments.first.user.should == "jackdempsey"
61
71
  end
62
72
 
63
73
  end
64
74
 
65
- describe ".create_issue" do
66
-
67
- it "should create an issue" do
68
- stub_post("issues/open/sferik/rails_admin").
69
- to_return(:body => fixture("issue.json"))
70
- issue = @client.create_issue("sferik/rails_admin", "Use OrmAdapter instead of talking directly to ActiveRecord", "Hi,\n\nI just tried to play with this in an app with no ActiveRecord. I was disappointed. It seems the only reason the engine relies on AR is to provide History functionality. I would argue that having the History in a database, and therefore tying the app to AR & SQL, isn't worth it. How about we change it to just dump to a CSV and remove the AR dep?\n\n$0.02")
71
- issue.number.should == 105
72
- end
73
-
74
- end
75
-
76
75
  describe ".close_issue" do
77
76
 
78
77
  it "should close an issue" do
79
78
  stub_post("issues/close/sferik/rails_admin/105").
80
- to_return(:body => fixture("issue.json"))
79
+ to_return(:body => fixture("v2/issue.json"))
81
80
  issue = @client.close_issue("sferik/rails_admin", 105)
82
81
  issue.number.should == 105
83
82
  end
@@ -88,7 +87,7 @@ describe Octokit::Client::Issues do
88
87
 
89
88
  it "should reopen an issue" do
90
89
  stub_post("issues/reopen/sferik/rails_admin/105").
91
- to_return(:body => fixture("issue.json"))
90
+ to_return(:body => fixture("v2/issue.json"))
92
91
  issue = @client.reopen_issue("sferik/rails_admin", 105)
93
92
  issue.number.should == 105
94
93
  end
@@ -99,7 +98,7 @@ describe Octokit::Client::Issues do
99
98
 
100
99
  it "should update an issue" do
101
100
  stub_post("issues/edit/sferik/rails_admin/105").
102
- to_return(:body => fixture("issue.json"))
101
+ to_return(:body => fixture("v2/issue.json"))
103
102
  issue = @client.update_issue("sferik/rails_admin", 105, "Use OrmAdapter instead of talking directly to ActiveRecord", "Hi,\n\nI just tried to play with this in an app with no ActiveRecord. I was disappointed. It seems the only reason the engine relies on AR is to provide History functionality. I would argue that having the History in a database, and therefore tying the app to AR & SQL, isn't worth it. How about we change it to just dump to a CSV and remove the AR dep?\n\n$0.02")
104
103
  issue.number.should == 105
105
104
  end
@@ -110,7 +109,7 @@ describe Octokit::Client::Issues do
110
109
 
111
110
  it "should return labels" do
112
111
  stub_get("issues/labels/sferik/rails_admin").
113
- to_return(:body => fixture("labels.json"))
112
+ to_return(:body => fixture("v2/labels.json"))
114
113
  labels = @client.labels("sferik/rails_admin")
115
114
  labels.first.should == "bug"
116
115
  end
@@ -121,7 +120,7 @@ describe Octokit::Client::Issues do
121
120
 
122
121
  it "should add a label" do
123
122
  stub_post("issues/label/add/sferik/rails_admin/bug").
124
- to_return(:body => fixture("labels.json"))
123
+ to_return(:body => fixture("v2/labels.json"))
125
124
  labels = @client.add_label("sferik/rails_admin", "bug")
126
125
  labels.first.should == "bug"
127
126
  end
@@ -132,7 +131,7 @@ describe Octokit::Client::Issues do
132
131
 
133
132
  it "should remove a label" do
134
133
  stub_post("issues/label/remove/sferik/rails_admin/bug").
135
- to_return(:body => fixture("labels.json"))
134
+ to_return(:body => fixture("v2/labels.json"))
136
135
  labels = @client.remove_label("sferik/rails_admin", "bug")
137
136
  labels.first.should == "bug"
138
137
  end
@@ -144,7 +143,7 @@ describe Octokit::Client::Issues do
144
143
  it "should add a comment" do
145
144
  stub_post("issues/comment/sferik/rails_admin/105").
146
145
  with(:comment => "I don't think I'd like it in a CSV for a variety of reasons, but I do agree that it doesn't have to be AR. I would imagine if there was a patch and work done towards allowing a pluggable History model, it'd be at least considered. I don't have the time at the moment to do this, but I'd imagine you could start with abstracting out the calls to read/write History, ultimately allowing for a drop in of any storage structure. \r\n\r\nIn fact, it might be interesting to leverage wycats moneta towards this end: http://github.com/wycats/moneta").
147
- to_return(:body => fixture("comment.json"))
146
+ to_return(:body => fixture("v2/comment.json"))
148
147
  comment = @client.add_comment("sferik/rails_admin", 105, "I don't think I'd like it in a CSV for a variety of reasons, but I do agree that it doesn't have to be AR. I would imagine if there was a patch and work done towards allowing a pluggable History model, it'd be at least considered. I don't have the time at the moment to do this, but I'd imagine you could start with abstracting out the calls to read/write History, ultimately allowing for a drop in of any storage structure. \r\n\r\nIn fact, it might be interesting to leverage wycats moneta towards this end: http://github.com/wycats/moneta")
149
148
  comment.user.should == "jackdempsey"
150
149
  end
@@ -11,7 +11,7 @@ describe Octokit::Client::Network do
11
11
 
12
12
  it "should return network meta" do
13
13
  stub_get("https://github.com/sferik/rails_admin/network_meta").
14
- to_return(:body => fixture("network_meta.json"))
14
+ to_return(:body => fixture("v2/network_meta.json"))
15
15
  network_meta = @client.network_meta("sferik/rails_admin")
16
16
  network_meta.blocks.first.name.should == "sferik"
17
17
  end
@@ -22,7 +22,7 @@ describe Octokit::Client::Network do
22
22
 
23
23
  it "should return network data" do
24
24
  stub_get("https://github.com/sferik/rails_admin/network_data_chunk").
25
- to_return(:body => fixture("network_data.json"))
25
+ to_return(:body => fixture("v2/network_data.json"))
26
26
  network_data = @client.network_data("sferik/rails_admin")
27
27
  network_data.first.login.should == "rosenfeld"
28
28
  end
@@ -11,7 +11,7 @@ describe Octokit::Client::Objects do
11
11
 
12
12
  it "should return a tree" do
13
13
  stub_get("tree/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
14
- to_return(:body => fixture("tree.json"))
14
+ to_return(:body => fixture("v2/tree.json"))
15
15
  tree = @client.tree("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
16
16
  tree.first.name.should == ".gitignore"
17
17
  end
@@ -22,7 +22,7 @@ describe Octokit::Client::Objects do
22
22
 
23
23
  it "should return a blob" do
24
24
  stub_get("blob/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd/README.mkd").
25
- to_return(:body => fixture("blob.json"))
25
+ to_return(:body => fixture("v2/blob.json"))
26
26
  blob = @client.blob("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd", "README.mkd")
27
27
  blob.name.should == "README.mkd"
28
28
  end
@@ -33,7 +33,7 @@ describe Octokit::Client::Objects do
33
33
 
34
34
  it "should return blobs" do
35
35
  stub_get("blob/all/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
36
- to_return(:body => fixture("blobs.json"))
36
+ to_return(:body => fixture("v2/blobs.json"))
37
37
  blobs = @client.blobs("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
38
38
  blobs[".gitignore"].should == "5efe0eb47a773fa6ea84a0bf190ee218b6a31ead"
39
39
  end
@@ -44,7 +44,7 @@ describe Octokit::Client::Objects do
44
44
 
45
45
  it "should return blob metadata" do
46
46
  stub_get("blob/full/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
47
- to_return(:body => fixture("blob_metadata.json"))
47
+ to_return(:body => fixture("v2/blob_metadata.json"))
48
48
  blob_metadata = @client.blob_metadata("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
49
49
  blob_metadata.first.name.should == ".gitignore"
50
50
  end
@@ -55,7 +55,7 @@ describe Octokit::Client::Objects do
55
55
 
56
56
  it "should return tree metadata" do
57
57
  stub_get("tree/full/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
58
- to_return(:body => fixture("tree_metadata.json"))
58
+ to_return(:body => fixture("v2/tree_metadata.json"))
59
59
  tree_metadata = @client.tree_metadata("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
60
60
  tree_metadata.first.name.should == ".gitignore"
61
61
  end
@@ -66,14 +66,11 @@ describe Octokit::Client::Objects do
66
66
 
67
67
  it "should return raw data" do
68
68
  stub_get("blob/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
69
- to_return(:body => fixture("raw.txt"))
69
+ to_return(:body => fixture("v2/raw.txt"))
70
70
  raw = @client.raw("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
71
71
  lambda {
72
72
  ::MultiJson.decode(raw)
73
73
  }.should raise_error
74
- lambda {
75
- ::MultiXml.decode(raw)
76
- }.should raise_error
77
74
  end
78
75
 
79
76
  end
@@ -11,7 +11,7 @@ describe Octokit::Client::Organizations do
11
11
 
12
12
  it "should return an organization" do
13
13
  stub_get("organizations/codeforamerica").
14
- to_return(:body => fixture("organization.json"))
14
+ to_return(:body => fixture("v2/organization.json"))
15
15
  organization = @client.organization("codeforamerica")
16
16
  organization.name.should == "Code For America"
17
17
  end
@@ -23,7 +23,7 @@ describe Octokit::Client::Organizations do
23
23
  it "should update an organization" do
24
24
  stub_put("organizations/codeforamerica").
25
25
  with(:name => "Code For America").
26
- to_return(:body => fixture("organization.json"))
26
+ to_return(:body => fixture("v2/organization.json"))
27
27
  organization = @client.update_organization("codeforamerica", {:name => "Code For America"})
28
28
  organization.name.should == "Code For America"
29
29
  end
@@ -36,7 +36,7 @@ describe Octokit::Client::Organizations do
36
36
 
37
37
  it "should return all organizations for a user" do
38
38
  stub_get("user/show/sferik/organizations").
39
- to_return(:body => fixture("organizations.json"))
39
+ to_return(:body => fixture("v2/organizations.json"))
40
40
  organizations = @client.organizations("sferik")
41
41
  organizations.first.name.should == "Hubcap"
42
42
  end
@@ -47,7 +47,7 @@ describe Octokit::Client::Organizations do
47
47
 
48
48
  it "should return all organizations for a user" do
49
49
  stub_get("organizations").
50
- to_return(:body => fixture("organizations.json"))
50
+ to_return(:body => fixture("v2/organizations.json"))
51
51
  organizations = @client.organizations
52
52
  organizations.first.name.should == "Hubcap"
53
53
  end
@@ -62,7 +62,7 @@ describe Octokit::Client::Organizations do
62
62
 
63
63
  it "should return all public repositories for an organization" do
64
64
  stub_get("organizations/codeforamerica/public_repositories").
65
- to_return(:body => fixture("repositories.json"))
65
+ to_return(:body => fixture("v2/repositories.json"))
66
66
  repositories = @client.organization_repositories("codeforamerica")
67
67
  repositories.first.name.should == "One40Proof"
68
68
  end
@@ -73,7 +73,7 @@ describe Octokit::Client::Organizations do
73
73
 
74
74
  it "should return all organization repositories for a user" do
75
75
  stub_get("organizations/repositories").
76
- to_return(:body => fixture("repositories.json"))
76
+ to_return(:body => fixture("v2/repositories.json"))
77
77
  repositories = @client.organization_repositories
78
78
  repositories.first.name.should == "One40Proof"
79
79
  end
@@ -86,7 +86,7 @@ describe Octokit::Client::Organizations do
86
86
 
87
87
  it "should return all public members of an organization" do
88
88
  stub_get("organizations/codeforamerica/public_members").
89
- to_return(:body => fixture("users.json"))
89
+ to_return(:body => fixture("v2/users.json"))
90
90
  users = @client.organization_members("codeforamerica")
91
91
  users.first.name.should == "Erik Michaels-Ober"
92
92
  end
@@ -97,7 +97,7 @@ describe Octokit::Client::Organizations do
97
97
 
98
98
  it "should return all teams for an organization" do
99
99
  stub_get("organizations/codeforamerica/teams").
100
- to_return(:body => fixture("teams.json"))
100
+ to_return(:body => fixture("v2/teams.json"))
101
101
  teams = @client.organization_teams("codeforamerica")
102
102
  teams.first.name.should == "Fellows"
103
103
  end
@@ -109,7 +109,7 @@ describe Octokit::Client::Organizations do
109
109
  it "should create a team" do
110
110
  stub_post("organizations/codeforamerica/teams").
111
111
  with(:name => "Fellows").
112
- to_return(:body => fixture("team.json"))
112
+ to_return(:body => fixture("v2/team.json"))
113
113
  team = @client.create_team("codeforamerica", {:name => "Fellows"})
114
114
  team.name.should == "Fellows"
115
115
  end
@@ -120,7 +120,7 @@ describe Octokit::Client::Organizations do
120
120
 
121
121
  it "should return a team" do
122
122
  stub_get("teams/32598").
123
- to_return(:body => fixture("team.json"))
123
+ to_return(:body => fixture("v2/team.json"))
124
124
  team = @client.team(32598)
125
125
  team.name.should == "Fellows"
126
126
  end
@@ -132,7 +132,7 @@ describe Octokit::Client::Organizations do
132
132
  it "should update a team" do
133
133
  stub_put("teams/32598").
134
134
  with(:name => "Fellows").
135
- to_return(:body => fixture("team.json"))
135
+ to_return(:body => fixture("v2/team.json"))
136
136
  team = @client.update_team(32598, :name => "Fellows")
137
137
  team.name.should == "Fellows"
138
138
  end
@@ -143,7 +143,7 @@ describe Octokit::Client::Organizations do
143
143
 
144
144
  it "should delete a team" do
145
145
  stub_delete("teams/32598").
146
- to_return(:body => fixture("team.json"))
146
+ to_return(:body => fixture("v2/team.json"))
147
147
  team = @client.delete_team(32598)
148
148
  team.name.should == "Fellows"
149
149
  end
@@ -154,7 +154,7 @@ describe Octokit::Client::Organizations do
154
154
 
155
155
  it "should delete a team" do
156
156
  stub_delete("teams/32598").
157
- to_return(:body => fixture("team.json"))
157
+ to_return(:body => fixture("v2/team.json"))
158
158
  team = @client.delete_team(32598)
159
159
  team.name.should == "Fellows"
160
160
  end
@@ -165,7 +165,7 @@ describe Octokit::Client::Organizations do
165
165
 
166
166
  it "should return team members" do
167
167
  stub_get("teams/32598/members").
168
- to_return(:body => fixture("users.json"))
168
+ to_return(:body => fixture("v2/users.json"))
169
169
  users = @client.team_members(32598)
170
170
  users.first.name.should == "Erik Michaels-Ober"
171
171
  end
@@ -177,7 +177,7 @@ describe Octokit::Client::Organizations do
177
177
  it "should add a team member" do
178
178
  stub_post("teams/32598/members").
179
179
  with(:name => "sferik").
180
- to_return(:body => fixture("user.json"))
180
+ to_return(:body => fixture("v2/user.json"))
181
181
  user = @client.add_team_member(32598, "sferik")
182
182
  user.name.should == "Erik Michaels-Ober"
183
183
  end
@@ -189,7 +189,7 @@ describe Octokit::Client::Organizations do
189
189
  it "should remove a team member" do
190
190
  stub_delete("teams/32598/members").
191
191
  with(:query => {:name => "sferik"}).
192
- to_return(:body => fixture("user.json"))
192
+ to_return(:body => fixture("v2/user.json"))
193
193
  user = @client.remove_team_member(32598, "sferik")
194
194
  user.name.should == "Erik Michaels-Ober"
195
195
  end
@@ -200,7 +200,7 @@ describe Octokit::Client::Organizations do
200
200
 
201
201
  it "should return team repositories" do
202
202
  stub_get("teams/32598/repositories").
203
- to_return(:body => fixture("repositories.json"))
203
+ to_return(:body => fixture("v2/repositories.json"))
204
204
  repositories = @client.team_repositories(32598)
205
205
  repositories.first.name.should == "One40Proof"
206
206
  end
@@ -212,7 +212,7 @@ describe Octokit::Client::Organizations do
212
212
  it "should add a team repository" do
213
213
  stub_post("teams/32598/repositories").
214
214
  with(:name => "reddavis/One40Proof").
215
- to_return(:body => fixture("repositories.json"))
215
+ to_return(:body => fixture("v2/repositories.json"))
216
216
  repositories = @client.add_team_repository(32598, "reddavis/One40Proof")
217
217
  repositories.first.name.should == "One40Proof"
218
218
  end
@@ -224,7 +224,7 @@ describe Octokit::Client::Organizations do
224
224
  it "should remove a team repository" do
225
225
  stub_delete("teams/32598/repositories").
226
226
  with(:query => {:name => "reddavis/One40Proof"}).
227
- to_return(:body => fixture("repositories.json"))
227
+ to_return(:body => fixture("v2/repositories.json"))
228
228
  repositories = @client.remove_team_repository(32598, "reddavis/One40Proof")
229
229
  repositories.first.name.should == "One40Proof"
230
230
  end
@@ -12,7 +12,7 @@ describe Octokit::Client::Pulls do
12
12
  it "should create a pull request" do
13
13
  stub_post("pulls/sferik/rails_admin").
14
14
  with(:pull => {:base => "master", :head => "pengwynn:master", :title => "Title", :body => "Body"}).
15
- to_return(:body => fixture("pulls.json"))
15
+ to_return(:body => fixture("v2/pulls.json"))
16
16
  issues = @client.create_pull_request("sferik/rails_admin", "master", "pengwynn:master", "Title", "Body")
17
17
  issues.first.number.should == 251
18
18
  end
@@ -23,7 +23,7 @@ describe Octokit::Client::Pulls do
23
23
 
24
24
  it "should return all pull requests" do
25
25
  stub_get("pulls/sferik/rails_admin/open").
26
- to_return(:body => fixture("pulls.json"))
26
+ to_return(:body => fixture("v2/pulls.json"))
27
27
  pulls = @client.pulls("sferik/rails_admin")
28
28
  pulls.first.number.should == 251
29
29
  end
@@ -34,7 +34,7 @@ describe Octokit::Client::Pulls do
34
34
 
35
35
  it "should return a pull request" do
36
36
  stub_get("pulls/sferik/rails_admin/251").
37
- to_return(:body => fixture("pull.json"))
37
+ to_return(:body => fixture("v2/pull.json"))
38
38
  pull = @client.pull("sferik/rails_admin", 251)
39
39
  pull.number.should == 251
40
40
  end
@@ -11,7 +11,7 @@ describe Octokit::Client::Repositories do
11
11
 
12
12
  it "should return matching repositories" do
13
13
  stub_get("repos/search/One40Proof").
14
- to_return(:body => fixture("repositories.json"))
14
+ to_return(:body => fixture("v2/repositories.json"))
15
15
  repositories = @client.search_repositories("One40Proof")
16
16
  repositories.first.name.should == "One40Proof"
17
17
  end
@@ -22,7 +22,7 @@ describe Octokit::Client::Repositories do
22
22
 
23
23
  it "should return the matching repository" do
24
24
  stub_get("repos/show/sferik/rails_admin").
25
- to_return(:body => fixture("repository.json"))
25
+ to_return(:body => fixture("v2/repository.json"))
26
26
  repository = @client.repository("sferik/rails_admin")
27
27
  repository.name.should == "rails_admin"
28
28
  end
@@ -35,7 +35,7 @@ describe Octokit::Client::Repositories do
35
35
  description = "RailsAdmin is a Rails 3 engine that provides an easy-to-use interface for managing your data"
36
36
  stub_post("repos/show/sferik/rails_admin").
37
37
  with(:values => {:description => description}).
38
- to_return(:body => fixture("repository.json"))
38
+ to_return(:body => fixture("v2/repository.json"))
39
39
  repository = @client.update_repository("sferik/rails_admin", :description => description)
40
40
  repository.description.should == description
41
41
  end
@@ -48,7 +48,7 @@ describe Octokit::Client::Repositories do
48
48
 
49
49
  it "should return user's repositories" do
50
50
  stub_get("repos/show/sferik").
51
- to_return(:body => fixture("repositories.json"))
51
+ to_return(:body => fixture("v2/repositories.json"))
52
52
  repositories = @client.repositories("sferik")
53
53
  repositories.first.name.should == "One40Proof"
54
54
  end
@@ -59,7 +59,7 @@ describe Octokit::Client::Repositories do
59
59
 
60
60
  it "should return authenticated user's repositories" do
61
61
  stub_get("repos/show/sferik").
62
- to_return(:body => fixture("repositories.json"))
62
+ to_return(:body => fixture("v2/repositories.json"))
63
63
  repositories = @client.repositories
64
64
  repositories.first.name.should == "One40Proof"
65
65
  end
@@ -72,7 +72,7 @@ describe Octokit::Client::Repositories do
72
72
 
73
73
  it "should watch a repository" do
74
74
  stub_post("repos/watch/sferik/rails_admin").
75
- to_return(:body => fixture("repository.json"))
75
+ to_return(:body => fixture("v2/repository.json"))
76
76
  repository = @client.watch("sferik/rails_admin")
77
77
  repository.name.should == "rails_admin"
78
78
  end
@@ -83,7 +83,7 @@ describe Octokit::Client::Repositories do
83
83
 
84
84
  it "should unwatch a repository" do
85
85
  stub_post("repos/unwatch/sferik/rails_admin").
86
- to_return(:body => fixture("repository.json"))
86
+ to_return(:body => fixture("v2/repository.json"))
87
87
  repository = @client.unwatch("sferik/rails_admin")
88
88
  repository.name.should == "rails_admin"
89
89
  end
@@ -94,7 +94,7 @@ describe Octokit::Client::Repositories do
94
94
 
95
95
  it "should fork a repository" do
96
96
  stub_post("repos/fork/sferik/rails_admin").
97
- to_return(:body => fixture("repository.json"))
97
+ to_return(:body => fixture("v2/repository.json"))
98
98
  repository = @client.fork("sferik/rails_admin")
99
99
  repository.name.should == "rails_admin"
100
100
  end
@@ -106,7 +106,7 @@ describe Octokit::Client::Repositories do
106
106
  it "should create a repository" do
107
107
  stub_post("repos/create").
108
108
  with(:name => "rails_admin").
109
- to_return(:body => fixture("repository.json"))
109
+ to_return(:body => fixture("v2/repository.json"))
110
110
  repository = @client.create_repository("rails_admin")
111
111
  repository.name.should == "rails_admin"
112
112
  end
@@ -117,20 +117,33 @@ describe Octokit::Client::Repositories do
117
117
 
118
118
  it "should return a delete token" do
119
119
  stub_post("repos/delete/sferik/rails_admin").
120
- to_return(:body => fixture("delete_token.json"))
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"
123
123
  end
124
124
 
125
125
  end
126
126
 
127
- describe ".delete_repository" do
127
+ describe ".delete_repository!" do
128
128
 
129
129
  it "should delete a repository" do
130
130
  stub_post("repos/delete/sferik/rails_admin").
131
- to_return(:body => fixture("repository.json"))
132
- repository = @client.delete_repository("sferik/rails_admin")
133
- repository.name.should == "rails_admin"
131
+ to_return(:body => fixture("v2/delete_token.json"))
132
+ stub_post("repos/delete/sferik/rails_admin").
133
+ with(:delete_token => "uhihwkkkzu").
134
+ to_return(:status => 204)
135
+ @client.delete_repo!("sferik/rails_admin")
136
+ end
137
+
138
+ end
139
+
140
+ describe ".delete_repository" do
141
+
142
+ it "should return an error for non-existant repo" do
143
+ stub_post("repos/delete/sferik/rails_admin_failure").
144
+ to_return(:body => fixture("v2/delete_failure.json"))
145
+ response = @client.delete_repository("sferik/rails_admin_failure")
146
+ response.error.should == "sferik/rails_admin_failure Repository not found"
134
147
  end
135
148
 
136
149
  end
@@ -139,7 +152,7 @@ describe Octokit::Client::Repositories do
139
152
 
140
153
  it "should set a repository private" do
141
154
  stub_post("repos/set/private/sferik/rails_admin").
142
- to_return(:body => fixture("repository.json"))
155
+ to_return(:body => fixture("v2/repository.json"))
143
156
  repository = @client.set_private("sferik/rails_admin")
144
157
  repository.name.should == "rails_admin"
145
158
  end
@@ -150,7 +163,7 @@ describe Octokit::Client::Repositories do
150
163
 
151
164
  it "should set a repository public" do
152
165
  stub_post("repos/set/public/sferik/rails_admin").
153
- to_return(:body => fixture("repository.json"))
166
+ to_return(:body => fixture("v2/repository.json"))
154
167
  repository = @client.set_public("sferik/rails_admin")
155
168
  repository.name.should == "rails_admin"
156
169
  end
@@ -161,7 +174,7 @@ describe Octokit::Client::Repositories do
161
174
 
162
175
  it "should return a repository's deploy keys" do
163
176
  stub_get("repos/keys/sferik/rails_admin").
164
- to_return(:body => fixture("public_keys.json"))
177
+ to_return(:body => fixture("v2/public_keys.json"))
165
178
  public_keys = @client.deploy_keys("sferik/rails_admin")
166
179
  public_keys.first.id.should == 103205
167
180
  end
@@ -173,7 +186,7 @@ describe Octokit::Client::Repositories do
173
186
  it "should add a repository deploy keys" do
174
187
  stub_post("repos/key/sferik/rails_admin/add").
175
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").
176
- to_return(:body => fixture("public_keys.json"))
189
+ to_return(:body => fixture("v2/public_keys.json"))
177
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")
178
191
  public_keys.first.id.should == 103205
179
192
  end
@@ -185,7 +198,7 @@ describe Octokit::Client::Repositories do
185
198
  it "should remove a repository deploy keys" do
186
199
  stub_post("repos/key/sferik/rails_admin/remove").
187
200
  with(:id => 103205).
188
- to_return(:body => fixture("public_keys.json"))
201
+ to_return(:body => fixture("v2/public_keys.json"))
189
202
  public_keys = @client.remove_deploy_key("sferik/rails_admin", 103205)
190
203
  public_keys.first.id.should == 103205
191
204
  end
@@ -196,7 +209,7 @@ describe Octokit::Client::Repositories do
196
209
 
197
210
  it "should return a repository's collaborators" do
198
211
  stub_get("repos/show/sferik/rails_admin/collaborators").
199
- to_return(:body => fixture("collaborators.json"))
212
+ to_return(:body => fixture("v2/collaborators.json"))
200
213
  collaborators = @client.collaborators("sferik/rails_admin")
201
214
  collaborators.first.should == "sferik"
202
215
  end
@@ -207,7 +220,7 @@ describe Octokit::Client::Repositories do
207
220
 
208
221
  it "should add a repository collaborators" do
209
222
  stub_post("repos/collaborators/sferik/rails_admin/add/sferik").
210
- to_return(:body => fixture("collaborators.json"))
223
+ to_return(:body => fixture("v2/collaborators.json"))
211
224
  collaborators = @client.add_collaborator("sferik/rails_admin", "sferik")
212
225
  collaborators.first.should == "sferik"
213
226
  end
@@ -218,7 +231,7 @@ describe Octokit::Client::Repositories do
218
231
 
219
232
  it "should remove a repository collaborators" do
220
233
  stub_post("repos/collaborators/sferik/rails_admin/remove/sferik").
221
- to_return(:body => fixture("collaborators.json"))
234
+ to_return(:body => fixture("v2/collaborators.json"))
222
235
  collaborators = @client.remove_collaborator("sferik/rails_admin", "sferik")
223
236
  collaborators.first.should == "sferik"
224
237
  end
@@ -229,7 +242,7 @@ describe Octokit::Client::Repositories do
229
242
 
230
243
  it "should return all pushable repositories" do
231
244
  stub_get("repos/pushable").
232
- to_return(:body => fixture("repositories.json"))
245
+ to_return(:body => fixture("v2/repositories.json"))
233
246
  repositories = @client.pushable
234
247
  repositories.first.name.should == "One40Proof"
235
248
  end
@@ -240,7 +253,7 @@ describe Octokit::Client::Repositories do
240
253
 
241
254
  it "should return all repository teams" do
242
255
  stub_get("repos/show/codeforamerica/open311/teams").
243
- to_return(:body => fixture("teams.json"))
256
+ to_return(:body => fixture("v2/teams.json"))
244
257
  teams = @client.repository_teams("codeforamerica/open311")
245
258
  teams.first.name.should == "Fellows"
246
259
  end
@@ -253,7 +266,7 @@ describe Octokit::Client::Repositories do
253
266
 
254
267
  it "should return all repository contributors" do
255
268
  stub_get("repos/show/sferik/rails_admin/contributors/anon").
256
- to_return(:body => fixture("contributors.json"))
269
+ to_return(:body => fixture("v2/contributors.json"))
257
270
  contributors = @client.contributors("sferik/rails_admin", true)
258
271
  contributors.first.name.should == "Erik Michaels-Ober"
259
272
  end
@@ -264,7 +277,7 @@ describe Octokit::Client::Repositories do
264
277
 
265
278
  it "should return all repository contributors" do
266
279
  stub_get("repos/show/sferik/rails_admin/contributors").
267
- to_return(:body => fixture("contributors.json"))
280
+ to_return(:body => fixture("v2/contributors.json"))
268
281
  contributors = @client.contributors("sferik/rails_admin")
269
282
  contributors.first.name.should == "Erik Michaels-Ober"
270
283
  end
@@ -277,7 +290,7 @@ describe Octokit::Client::Repositories do
277
290
 
278
291
  it "should return all repository watchers" do
279
292
  stub_get("repos/show/sferik/rails_admin/watchers").
280
- to_return(:body => fixture("watchers.json"))
293
+ to_return(:body => fixture("v2/watchers.json"))
281
294
  watchers = @client.watchers("sferik/rails_admin")
282
295
  watchers.first.should == "sferik"
283
296
  end
@@ -288,7 +301,7 @@ describe Octokit::Client::Repositories do
288
301
 
289
302
  it "should return a repository's network" do
290
303
  stub_get("repos/show/sferik/rails_admin/network").
291
- to_return(:body => fixture("network.json"))
304
+ to_return(:body => fixture("v2/network.json"))
292
305
  network = @client.network("sferik/rails_admin")
293
306
  network.first.owner.should == "sferik"
294
307
  end
@@ -299,7 +312,7 @@ describe Octokit::Client::Repositories do
299
312
 
300
313
  it "should return a repository's languages" do
301
314
  stub_get("repos/show/sferik/rails_admin/languages").
302
- to_return(:body => fixture("languages.json"))
315
+ to_return(:body => fixture("v2/languages.json"))
303
316
  languages = @client.languages("sferik/rails_admin")
304
317
  languages["Ruby"].should == 205046
305
318
  end
@@ -310,7 +323,7 @@ describe Octokit::Client::Repositories do
310
323
 
311
324
  it "should return a repository's tags" do
312
325
  stub_get("repos/show/pengwynn/octokit/tags").
313
- to_return(:body => fixture("tags.json"))
326
+ to_return(:body => fixture("v2/tags.json"))
314
327
  tags = @client.tags("pengwynn/octokit")
315
328
  tags["v0.0.1"].should == "0d7a03f2035ecd74e4d6eb9be58865c2a688ee55"
316
329
  end
@@ -321,7 +334,7 @@ describe Octokit::Client::Repositories do
321
334
 
322
335
  it "should return a repository's branches" do
323
336
  stub_get("repos/show/pengwynn/octokit/branches").
324
- to_return(:body => fixture("branches.json"))
337
+ to_return(:body => fixture("v2/branches.json"))
325
338
  branches = @client.branches("pengwynn/octokit")
326
339
  branches["master"].should == "4d9a9e9ca183bab1c3d0accf1d53edd85bd6200f"
327
340
  end