github_api 0.4.4 → 0.4.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.
Files changed (62) hide show
  1. data/features/error_codes.feature +1 -1
  2. data/lib/github_api/error.rb +25 -32
  3. data/lib/github_api/error/bad_request.rb +12 -0
  4. data/lib/github_api/error/forbidden.rb +12 -0
  5. data/lib/github_api/error/internal_server_error.rb +12 -0
  6. data/lib/github_api/error/not_found.rb +12 -0
  7. data/lib/github_api/error/service_error.rb +19 -0
  8. data/lib/github_api/error/service_unavailable.rb +12 -0
  9. data/lib/github_api/error/unauthorized.rb +12 -0
  10. data/lib/github_api/error/unprocessable_entity.rb +12 -0
  11. data/lib/github_api/gists.rb +1 -1
  12. data/lib/github_api/orgs/members.rb +2 -2
  13. data/lib/github_api/orgs/teams.rb +2 -2
  14. data/lib/github_api/pull_requests.rb +14 -7
  15. data/lib/github_api/pull_requests/comments.rb +19 -14
  16. data/lib/github_api/repos/collaborators.rb +1 -1
  17. data/lib/github_api/repos/watching.rb +1 -1
  18. data/lib/github_api/response/raise_error.rb +8 -13
  19. data/lib/github_api/users/followers.rb +1 -1
  20. data/lib/github_api/version.rb +1 -1
  21. data/spec/fixtures/pull_requests/comment.json +17 -0
  22. data/spec/fixtures/pull_requests/comments.json +19 -0
  23. data/spec/fixtures/pull_requests/commits.json +27 -0
  24. data/spec/fixtures/pull_requests/files.json +13 -0
  25. data/spec/fixtures/pull_requests/merge_failure.json +5 -0
  26. data/spec/fixtures/pull_requests/merge_success.json +5 -0
  27. data/spec/fixtures/pull_requests/pull_request.json +123 -0
  28. data/spec/fixtures/pull_requests/pull_requests.json +31 -0
  29. data/spec/github/authorizations_spec.rb +5 -5
  30. data/spec/github/events_spec.rb +8 -8
  31. data/spec/github/gists/comments_spec.rb +5 -5
  32. data/spec/github/gists_spec.rb +7 -7
  33. data/spec/github/git_data/blobs_spec.rb +2 -2
  34. data/spec/github/git_data/commits_spec.rb +2 -2
  35. data/spec/github/git_data/references_spec.rb +4 -4
  36. data/spec/github/git_data/tags_spec.rb +2 -2
  37. data/spec/github/git_data/trees_spec.rb +2 -2
  38. data/spec/github/git_data_spec.rb +0 -1
  39. data/spec/github/issues/comments_spec.rb +5 -5
  40. data/spec/github/issues/events_spec.rb +2 -2
  41. data/spec/github/issues/labels_spec.rb +10 -10
  42. data/spec/github/issues/milestones_spec.rb +5 -5
  43. data/spec/github/issues_spec.rb +5 -5
  44. data/spec/github/orgs/members_spec.rb +5 -5
  45. data/spec/github/orgs/teams_spec.rb +11 -11
  46. data/spec/github/orgs_spec.rb +3 -3
  47. data/spec/github/pull_requests/comments_spec.rb +265 -0
  48. data/spec/github/pull_requests_spec.rb +414 -0
  49. data/spec/github/repos/collaborators_spec.rb +3 -3
  50. data/spec/github/repos/commits_spec.rb +8 -8
  51. data/spec/github/repos/downloads_spec.rb +5 -5
  52. data/spec/github/repos/forks_spec.rb +2 -2
  53. data/spec/github/repos/hooks_spec.rb +6 -6
  54. data/spec/github/repos/keys_spec.rb +5 -5
  55. data/spec/github/repos/pub_sub_hubbub_spec.rb +2 -2
  56. data/spec/github/repos/watching_spec.rb +6 -6
  57. data/spec/github/repos_spec.rb +11 -11
  58. data/spec/github/users/emails_spec.rb +5 -0
  59. data/spec/github/users/followers_spec.rb +5 -0
  60. data/spec/github/users/keys_spec.rb +5 -0
  61. data/spec/github/users_spec.rb +2 -2
  62. metadata +23 -2
@@ -53,7 +53,7 @@ describe Github::Gists, :type => :base do
53
53
  it "should return 404 with a message 'Not Found'" do
54
54
  expect {
55
55
  github.gists.gists user
56
- }.to raise_error(Github::ResourceNotFound)
56
+ }.to raise_error(Github::Error::NotFound)
57
57
  end
58
58
  end
59
59
  end # unauthenticated user
@@ -134,7 +134,7 @@ describe Github::Gists, :type => :base do
134
134
  it "should return 404 with a message 'Not Found'" do
135
135
  expect {
136
136
  github.gists.starred
137
- }.to raise_error(Github::ResourceNotFound)
137
+ }.to raise_error(Github::Error::NotFound)
138
138
  end
139
139
  end
140
140
 
@@ -184,7 +184,7 @@ describe Github::Gists, :type => :base do
184
184
  it "should fail to retrive resource" do
185
185
  expect {
186
186
  github.gists.gist gist_id
187
- }.to raise_error(Github::ResourceNotFound)
187
+ }.to raise_error(Github::Error::NotFound)
188
188
  end
189
189
  end
190
190
  end # gist
@@ -250,7 +250,7 @@ describe Github::Gists, :type => :base do
250
250
  it "should faile to retrieve resource" do
251
251
  expect {
252
252
  github.gists.create_gist inputs
253
- }.to raise_error(Github::ResourceNotFound)
253
+ }.to raise_error(Github::Error::NotFound)
254
254
  end
255
255
  end
256
256
  end # create_gist
@@ -311,7 +311,7 @@ describe Github::Gists, :type => :base do
311
311
  it "should fail to retrieve resource" do
312
312
  expect {
313
313
  github.gists.edit_gist gist_id, inputs
314
- }.to raise_error(Github::ResourceNotFound)
314
+ }.to raise_error(Github::Error::NotFound)
315
315
  end
316
316
  end
317
317
  end # edit_gist
@@ -426,7 +426,7 @@ describe Github::Gists, :type => :base do
426
426
  :headers => {:content_type => "application/json; charset=utf-8"})
427
427
  expect {
428
428
  github.gists.fork gist_id
429
- }.to raise_error(Github::ResourceNotFound)
429
+ }.to raise_error(Github::Error::NotFound)
430
430
  end
431
431
  end # fork
432
432
 
@@ -456,7 +456,7 @@ describe Github::Gists, :type => :base do
456
456
  :headers => {:content_type => "application/json; charset=utf-8"})
457
457
  expect {
458
458
  github.gists.delete_gist gist_id
459
- }.to raise_error(Github::ResourceNotFound)
459
+ }.to raise_error(Github::Error::NotFound)
460
460
  end
461
461
  end # delete_gist
462
462
 
@@ -45,7 +45,7 @@ describe Github::GitData::Blobs, :type => :base do
45
45
  it "should fail to retrive resource" do
46
46
  expect {
47
47
  github.git_data.blob user, repo, sha
48
- }.to raise_error(Github::ResourceNotFound)
48
+ }.to raise_error(Github::Error::NotFound)
49
49
  end
50
50
  end
51
51
  end # blob
@@ -104,7 +104,7 @@ describe Github::GitData::Blobs, :type => :base do
104
104
  it "should faile to retrieve resource" do
105
105
  expect {
106
106
  github.git_data.create_blob user, repo, inputs
107
- }.to raise_error(Github::ResourceNotFound)
107
+ }.to raise_error(Github::Error::NotFound)
108
108
  end
109
109
  end
110
110
  end # create_blob
@@ -45,7 +45,7 @@ describe Github::GitData::Commits, :type => :base do
45
45
  it "should fail to retrive resource" do
46
46
  expect {
47
47
  github.git_data.commit user, repo, sha
48
- }.to raise_error(Github::ResourceNotFound)
48
+ }.to raise_error(Github::Error::NotFound)
49
49
  end
50
50
  end
51
51
  end # commit
@@ -118,7 +118,7 @@ describe Github::GitData::Commits, :type => :base do
118
118
  it "should faile to retrieve resource" do
119
119
  expect {
120
120
  github.git_data.create_commit user, repo, inputs
121
- }.to raise_error(Github::ResourceNotFound)
121
+ }.to raise_error(Github::Error::NotFound)
122
122
  end
123
123
  end
124
124
  end # create_commit
@@ -81,7 +81,7 @@ describe Github::GitData::References, :type => :base do
81
81
  it "should return 404 with a message 'Not Found'" do
82
82
  expect {
83
83
  github.git_data.references user, repo, ref
84
- }.to raise_error(Github::ResourceNotFound)
84
+ }.to raise_error(Github::Error::NotFound)
85
85
  end
86
86
  end
87
87
  end # references
@@ -131,7 +131,7 @@ describe Github::GitData::References, :type => :base do
131
131
  it "should fail to retrive resource" do
132
132
  expect {
133
133
  github.git_data.reference user, repo, ref
134
- }.to raise_error(Github::ResourceNotFound)
134
+ }.to raise_error(Github::Error::NotFound)
135
135
  end
136
136
  end
137
137
  end # reference
@@ -196,7 +196,7 @@ describe Github::GitData::References, :type => :base do
196
196
  it "should faile to retrieve resource" do
197
197
  expect {
198
198
  github.git_data.create_reference user, repo, inputs
199
- }.to raise_error(Github::ResourceNotFound)
199
+ }.to raise_error(Github::Error::NotFound)
200
200
  end
201
201
  end
202
202
  end # create_reference
@@ -255,7 +255,7 @@ describe Github::GitData::References, :type => :base do
255
255
  it "should faile to retrieve resource" do
256
256
  expect {
257
257
  github.git_data.update_reference user, repo, ref, inputs
258
- }.to raise_error(Github::ResourceNotFound)
258
+ }.to raise_error(Github::Error::NotFound)
259
259
  end
260
260
  end
261
261
  end # update_reference
@@ -45,7 +45,7 @@ describe Github::GitData::Tags, :type => :base do
45
45
  it "should fail to retrive resource" do
46
46
  expect {
47
47
  github.git_data.tag user, repo, sha
48
- }.to raise_error(Github::ResourceNotFound)
48
+ }.to raise_error(Github::Error::NotFound)
49
49
  end
50
50
  end
51
51
  end # tag
@@ -103,7 +103,7 @@ describe Github::GitData::Tags, :type => :base do
103
103
  it "should faile to retrieve resource" do
104
104
  expect {
105
105
  github.git_data.create_tag user, repo, inputs
106
- }.to raise_error(Github::ResourceNotFound)
106
+ }.to raise_error(Github::Error::NotFound)
107
107
  end
108
108
  end
109
109
  end # create_tag
@@ -67,7 +67,7 @@ describe Github::GitData::Trees, :type => :base do
67
67
  it "should fail to retrive resource" do
68
68
  expect {
69
69
  github.git_data.tree user, repo, sha
70
- }.to raise_error(Github::ResourceNotFound)
70
+ }.to raise_error(Github::Error::NotFound)
71
71
  end
72
72
  end
73
73
  end # tree
@@ -125,7 +125,7 @@ describe Github::GitData::Trees, :type => :base do
125
125
  it "should faile to retrieve resource" do
126
126
  expect {
127
127
  github.git_data.create_tree user, repo, inputs
128
- }.to raise_error(Github::ResourceNotFound)
128
+ }.to raise_error(Github::Error::NotFound)
129
129
  end
130
130
  end
131
131
  end # create_tree
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Github::GitData do
4
- pending
5
4
  end
@@ -59,7 +59,7 @@ describe Github::Issues::Comments, :type => :base do
59
59
  it "should return 404 with a message 'Not Found'" do
60
60
  expect {
61
61
  github.issues.comments user, repo, issue_id
62
- }.to raise_error(Github::ResourceNotFound)
62
+ }.to raise_error(Github::Error::NotFound)
63
63
  end
64
64
  end
65
65
  end # comments
@@ -107,7 +107,7 @@ describe Github::Issues::Comments, :type => :base do
107
107
  it "should fail to retrive resource" do
108
108
  expect {
109
109
  github.issues.comment user, repo, comment_id
110
- }.to raise_error(Github::ResourceNotFound)
110
+ }.to raise_error(Github::Error::NotFound)
111
111
  end
112
112
  end
113
113
  end # comment
@@ -156,7 +156,7 @@ describe Github::Issues::Comments, :type => :base do
156
156
  it "should fail to retrieve resource" do
157
157
  expect {
158
158
  github.issues.create_comment user, repo, issue_id, inputs
159
- }.to raise_error(Github::ResourceNotFound)
159
+ }.to raise_error(Github::Error::NotFound)
160
160
  end
161
161
  end
162
162
  end # create_comment
@@ -205,7 +205,7 @@ describe Github::Issues::Comments, :type => :base do
205
205
  it "should fail to retrieve resource" do
206
206
  expect {
207
207
  github.issues.edit_comment user, repo, comment_id, inputs
208
- }.to raise_error(Github::ResourceNotFound)
208
+ }.to raise_error(Github::Error::NotFound)
209
209
  end
210
210
  end
211
211
  end # edit_comment
@@ -243,7 +243,7 @@ describe Github::Issues::Comments, :type => :base do
243
243
  it "should fail to retrieve resource" do
244
244
  expect {
245
245
  github.issues.delete_comment user, repo, comment_id
246
- }.to raise_error(Github::ResourceNotFound)
246
+ }.to raise_error(Github::Error::NotFound)
247
247
  end
248
248
  end
249
249
  end # delete_comment
@@ -58,7 +58,7 @@ describe Github::Issues::Events, :type => :base do
58
58
  it "should return 404 with a message 'Not Found'" do
59
59
  expect {
60
60
  github.issues.events user, repo, issue_id
61
- }.to raise_error(Github::ResourceNotFound)
61
+ }.to raise_error(Github::Error::NotFound)
62
62
  end
63
63
  end
64
64
 
@@ -144,7 +144,7 @@ describe Github::Issues::Events, :type => :base do
144
144
  it "should fail to retrive resource" do
145
145
  expect {
146
146
  github.issues.event user, repo, event_id
147
- }.to raise_error(Github::ResourceNotFound)
147
+ }.to raise_error(Github::Error::NotFound)
148
148
  end
149
149
  end
150
150
  end # event
@@ -55,7 +55,7 @@ describe Github::Issues::Labels, :type => :base do
55
55
  it "should return 404 with a message 'Not Found'" do
56
56
  expect {
57
57
  github.issues.labels user, repo
58
- }.to raise_error(Github::ResourceNotFound)
58
+ }.to raise_error(Github::Error::NotFound)
59
59
  end
60
60
  end
61
61
  end # labels
@@ -101,7 +101,7 @@ describe Github::Issues::Labels, :type => :base do
101
101
  it "should fail to retrive resource" do
102
102
  expect {
103
103
  github.issues.label user, repo, label_id
104
- }.to raise_error(Github::ResourceNotFound)
104
+ }.to raise_error(Github::Error::NotFound)
105
105
  end
106
106
  end
107
107
  end # label
@@ -158,7 +158,7 @@ describe Github::Issues::Labels, :type => :base do
158
158
  it "should faile to retrieve resource" do
159
159
  expect {
160
160
  github.issues.create_label user, repo, inputs
161
- }.to raise_error(Github::ResourceNotFound)
161
+ }.to raise_error(Github::Error::NotFound)
162
162
  end
163
163
  end
164
164
  end # create_label
@@ -216,7 +216,7 @@ describe Github::Issues::Labels, :type => :base do
216
216
  it "should faile to retrieve resource" do
217
217
  expect {
218
218
  github.issues.update_label user, repo, label_id, inputs
219
- }.to raise_error(Github::ResourceNotFound)
219
+ }.to raise_error(Github::Error::NotFound)
220
220
  end
221
221
  end
222
222
  end # update_label
@@ -255,7 +255,7 @@ describe Github::Issues::Labels, :type => :base do
255
255
  it "should faile to retrieve resource" do
256
256
  expect {
257
257
  github.issues.delete_label user, repo, label_id
258
- }.to raise_error(Github::ResourceNotFound)
258
+ }.to raise_error(Github::Error::NotFound)
259
259
  end
260
260
  end
261
261
  end # delete_label
@@ -314,7 +314,7 @@ describe Github::Issues::Labels, :type => :base do
314
314
  it "should return 404 with a message 'Not Found'" do
315
315
  expect {
316
316
  github.issues.labels_for user, repo, issue_id
317
- }.to raise_error(Github::ResourceNotFound)
317
+ }.to raise_error(Github::Error::NotFound)
318
318
  end
319
319
  end
320
320
  end # labels_for
@@ -361,7 +361,7 @@ describe Github::Issues::Labels, :type => :base do
361
361
  it "should fail to retrieve resource" do
362
362
  expect {
363
363
  github.issues.add_labels user, repo, issue_id, labels
364
- }.to raise_error(Github::ResourceNotFound)
364
+ }.to raise_error(Github::Error::NotFound)
365
365
  end
366
366
  end
367
367
  end # add_labels
@@ -419,7 +419,7 @@ describe Github::Issues::Labels, :type => :base do
419
419
  it "should faile to retrieve resource" do
420
420
  expect {
421
421
  github.issues.remove_label user, repo, issue_id, label_id
422
- }.to raise_error(Github::ResourceNotFound)
422
+ }.to raise_error(Github::Error::NotFound)
423
423
  end
424
424
  end
425
425
  end # remove_label
@@ -466,7 +466,7 @@ describe Github::Issues::Labels, :type => :base do
466
466
  it "should fail to retrieve resource" do
467
467
  expect {
468
468
  github.issues.replace_labels user, repo, issue_id, labels
469
- }.to raise_error(Github::ResourceNotFound)
469
+ }.to raise_error(Github::Error::NotFound)
470
470
  end
471
471
  end
472
472
  end # add_labels
@@ -526,7 +526,7 @@ describe Github::Issues::Labels, :type => :base do
526
526
  it "should return 404 with a message 'Not Found'" do
527
527
  expect {
528
528
  github.issues.milestone_labels user, repo, milestone_id
529
- }.to raise_error(Github::ResourceNotFound)
529
+ }.to raise_error(Github::Error::NotFound)
530
530
  end
531
531
  end
532
532
  end # milestone_labels
@@ -56,7 +56,7 @@ describe Github::Issues::Milestones, :type => :base do
56
56
  it "should return 404 with a message 'Not Found'" do
57
57
  expect {
58
58
  github.issues.milestones user, repo
59
- }.to raise_error(Github::ResourceNotFound)
59
+ }.to raise_error(Github::Error::NotFound)
60
60
  end
61
61
  end
62
62
  end # milestones
@@ -103,7 +103,7 @@ describe Github::Issues::Milestones, :type => :base do
103
103
  it "should fail to retrive resource" do
104
104
  expect {
105
105
  github.issues.milestone user, repo, milestone_id
106
- }.to raise_error(Github::ResourceNotFound)
106
+ }.to raise_error(Github::Error::NotFound)
107
107
  end
108
108
  end
109
109
  end # milestone
@@ -156,7 +156,7 @@ describe Github::Issues::Milestones, :type => :base do
156
156
  it "should faile to retrieve resource" do
157
157
  expect {
158
158
  github.issues.create_milestone user, repo, inputs
159
- }.to raise_error(Github::ResourceNotFound)
159
+ }.to raise_error(Github::Error::NotFound)
160
160
  end
161
161
  end
162
162
  end # create_milestone
@@ -210,7 +210,7 @@ describe Github::Issues::Milestones, :type => :base do
210
210
  it "should faile to retrieve resource" do
211
211
  expect {
212
212
  github.issues.update_milestone user, repo, milestone_id, inputs
213
- }.to raise_error(Github::ResourceNotFound)
213
+ }.to raise_error(Github::Error::NotFound)
214
214
  end
215
215
  end
216
216
  end # update_milestone
@@ -249,7 +249,7 @@ describe Github::Issues::Milestones, :type => :base do
249
249
  it "should faile to retrieve resource" do
250
250
  expect {
251
251
  github.issues.delete_milestone user, repo, milestone_id
252
- }.to raise_error(Github::ResourceNotFound)
252
+ }.to raise_error(Github::Error::NotFound)
253
253
  end
254
254
  end
255
255
  end # delete_milestone
@@ -60,7 +60,7 @@ describe Github::Issues do
60
60
  end
61
61
 
62
62
  it "should return 404 with a message 'Not Found'" do
63
- expect { github.issues.issues }.to raise_error(Github::ResourceNotFound)
63
+ expect { github.issues.issues }.to raise_error(Github::Error::NotFound)
64
64
  end
65
65
  end
66
66
  end # issues
@@ -119,7 +119,7 @@ describe Github::Issues do
119
119
  it "should return 404 with a message 'Not Found'" do
120
120
  expect {
121
121
  github.issues.repo_issues user, repo
122
- }.to raise_error(Github::ResourceNotFound)
122
+ }.to raise_error(Github::Error::NotFound)
123
123
  end
124
124
  end
125
125
  end # repo_issues
@@ -166,7 +166,7 @@ describe Github::Issues do
166
166
  it "should fail to retrive resource" do
167
167
  expect {
168
168
  github.issues.issue user, repo, issue_id
169
- }.to raise_error(Github::ResourceNotFound)
169
+ }.to raise_error(Github::Error::NotFound)
170
170
  end
171
171
  end
172
172
  end # get_issue
@@ -221,7 +221,7 @@ describe Github::Issues do
221
221
  it "should faile to retrieve resource" do
222
222
  expect {
223
223
  github.issues.create_issue user, repo, inputs
224
- }.to raise_error(Github::ResourceNotFound)
224
+ }.to raise_error(Github::Error::NotFound)
225
225
  end
226
226
  end
227
227
  end # create_issue
@@ -279,7 +279,7 @@ describe Github::Issues do
279
279
  it "should fail to find resource" do
280
280
  expect {
281
281
  github.issues.edit_issue user, repo, issue_id, inputs
282
- }.to raise_error(Github::ResourceNotFound)
282
+ }.to raise_error(Github::Error::NotFound)
283
283
  end
284
284
  end
285
285
  end # edit_issue
@@ -53,7 +53,7 @@ describe Github::Orgs::Members do
53
53
  it "should return 404 with a message 'Not Found'" do
54
54
  expect {
55
55
  github.orgs.members org
56
- }.to raise_error(Github::ResourceNotFound)
56
+ }.to raise_error(Github::Error::NotFound)
57
57
  end
58
58
  end
59
59
  end # members
@@ -138,7 +138,7 @@ describe Github::Orgs::Members do
138
138
  it "should return 404 with a message 'Not Found'" do
139
139
  expect {
140
140
  github.orgs.public_members org
141
- }.to raise_error(Github::ResourceNotFound)
141
+ }.to raise_error(Github::Error::NotFound)
142
142
  end
143
143
  end
144
144
  end # public_members
@@ -202,7 +202,7 @@ describe Github::Orgs::Members do
202
202
  it "should return 404 with a message 'Not Found'" do
203
203
  expect {
204
204
  github.orgs.publicize org, member
205
- }.to raise_error(Github::ResourceNotFound)
205
+ }.to raise_error(Github::Error::NotFound)
206
206
  end
207
207
  end
208
208
  end # publicize
@@ -233,7 +233,7 @@ describe Github::Orgs::Members do
233
233
  it "should return 404 with a message 'Not Found'" do
234
234
  expect {
235
235
  github.orgs.conceal org, member
236
- }.to raise_error(Github::ResourceNotFound)
236
+ }.to raise_error(Github::Error::NotFound)
237
237
  end
238
238
  end
239
239
  end # conceal
@@ -267,7 +267,7 @@ describe Github::Orgs::Members do
267
267
  it "should fail to find resource" do
268
268
  expect {
269
269
  github.orgs.delete_member org, member
270
- }.to raise_error(Github::ResourceNotFound)
270
+ }.to raise_error(Github::Error::NotFound)
271
271
  end
272
272
  end
273
273
  end # delete_member