github_api 0.3.4 → 0.3.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 (138) hide show
  1. metadata +4 -140
  2. data/LICENSE.txt +0 -20
  3. data/README.rdoc +0 -228
  4. data/Rakefile +0 -52
  5. data/features/github_api.feature +0 -50
  6. data/features/step_definitions/github_api_steps.rb +0 -11
  7. data/features/support/env.rb +0 -13
  8. data/lib/github_api.rb +0 -73
  9. data/lib/github_api/api.rb +0 -175
  10. data/lib/github_api/api/utils.rb +0 -9
  11. data/lib/github_api/authorization.rb +0 -73
  12. data/lib/github_api/authorizations.rb +0 -119
  13. data/lib/github_api/cache_control.rb +0 -19
  14. data/lib/github_api/client.rb +0 -55
  15. data/lib/github_api/compatibility.rb +0 -23
  16. data/lib/github_api/configuration.rb +0 -96
  17. data/lib/github_api/connection.rb +0 -81
  18. data/lib/github_api/core_ext/array.rb +0 -14
  19. data/lib/github_api/core_ext/hash.rb +0 -42
  20. data/lib/github_api/error.rb +0 -35
  21. data/lib/github_api/events.rb +0 -202
  22. data/lib/github_api/gists.rb +0 -200
  23. data/lib/github_api/gists/comments.rb +0 -86
  24. data/lib/github_api/git_data.rb +0 -26
  25. data/lib/github_api/git_data/blobs.rb +0 -51
  26. data/lib/github_api/git_data/commits.rb +0 -78
  27. data/lib/github_api/git_data/references.rb +0 -113
  28. data/lib/github_api/git_data/tags.rb +0 -78
  29. data/lib/github_api/git_data/trees.rb +0 -89
  30. data/lib/github_api/issues.rb +0 -215
  31. data/lib/github_api/issues/comments.rb +0 -110
  32. data/lib/github_api/issues/events.rb +0 -50
  33. data/lib/github_api/issues/labels.rb +0 -191
  34. data/lib/github_api/issues/milestones.rb +0 -119
  35. data/lib/github_api/mime_type.rb +0 -55
  36. data/lib/github_api/orgs.rb +0 -95
  37. data/lib/github_api/orgs/members.rb +0 -120
  38. data/lib/github_api/orgs/teams.rb +0 -245
  39. data/lib/github_api/pull_requests.rb +0 -224
  40. data/lib/github_api/pull_requests/comments.rb +0 -144
  41. data/lib/github_api/repos.rb +0 -286
  42. data/lib/github_api/repos/collaborators.rb +0 -81
  43. data/lib/github_api/repos/commits.rb +0 -180
  44. data/lib/github_api/repos/downloads.rb +0 -155
  45. data/lib/github_api/repos/forks.rb +0 -48
  46. data/lib/github_api/repos/hooks.rb +0 -173
  47. data/lib/github_api/repos/keys.rb +0 -104
  48. data/lib/github_api/repos/pub_sub_hubbub.rb +0 -102
  49. data/lib/github_api/repos/watching.rb +0 -94
  50. data/lib/github_api/request.rb +0 -84
  51. data/lib/github_api/request/basic_auth.rb +0 -31
  52. data/lib/github_api/request/caching.rb +0 -33
  53. data/lib/github_api/request/oauth2.rb +0 -33
  54. data/lib/github_api/response.rb +0 -28
  55. data/lib/github_api/response/helpers.rb +0 -14
  56. data/lib/github_api/response/jsonize.rb +0 -26
  57. data/lib/github_api/response/mashify.rb +0 -24
  58. data/lib/github_api/response/raise_error.rb +0 -33
  59. data/lib/github_api/result.rb +0 -42
  60. data/lib/github_api/users.rb +0 -84
  61. data/lib/github_api/users/emails.rb +0 -49
  62. data/lib/github_api/users/followers.rb +0 -98
  63. data/lib/github_api/users/keys.rb +0 -84
  64. data/lib/github_api/version.rb +0 -12
  65. data/spec/README.rdoc +0 -22
  66. data/spec/coverage_adapter.rb +0 -14
  67. data/spec/fixtures/auths/authorization.json +0 -14
  68. data/spec/fixtures/auths/authorizations.json +0 -16
  69. data/spec/fixtures/events/events.json +0 -29
  70. data/spec/fixtures/issues/issue.json +0 -56
  71. data/spec/fixtures/issues/issues.json +0 -58
  72. data/spec/fixtures/orgs/members.json +0 -9
  73. data/spec/fixtures/orgs/org.json +0 -18
  74. data/spec/fixtures/orgs/orgs.json +0 -8
  75. data/spec/fixtures/orgs/team.json +0 -8
  76. data/spec/fixtures/orgs/team_repos.json +0 -29
  77. data/spec/fixtures/orgs/teams.json +0 -7
  78. data/spec/fixtures/repos/branches.json +0 -9
  79. data/spec/fixtures/repos/collaborators.json +0 -8
  80. data/spec/fixtures/repos/commit.json +0 -53
  81. data/spec/fixtures/repos/commit_comment.json +0 -16
  82. data/spec/fixtures/repos/commit_comments.json +0 -18
  83. data/spec/fixtures/repos/commits.json +0 -27
  84. data/spec/fixtures/repos/contributors.json +0 -8
  85. data/spec/fixtures/repos/download.json +0 -10
  86. data/spec/fixtures/repos/download_s3.json +0 -21
  87. data/spec/fixtures/repos/downloads.json +0 -12
  88. data/spec/fixtures/repos/fork.json +0 -27
  89. data/spec/fixtures/repos/forks.json +0 -29
  90. data/spec/fixtures/repos/hook.json +0 -15
  91. data/spec/fixtures/repos/hooks.json +0 -10
  92. data/spec/fixtures/repos/key.json +0 -6
  93. data/spec/fixtures/repos/keys.json +0 -8
  94. data/spec/fixtures/repos/languages.json +0 -4
  95. data/spec/fixtures/repos/repo.json +0 -90
  96. data/spec/fixtures/repos/repo_comments.json +0 -18
  97. data/spec/fixtures/repos/repos.json +0 -29
  98. data/spec/fixtures/repos/tags.json +0 -11
  99. data/spec/fixtures/repos/teams.json +0 -7
  100. data/spec/fixtures/repos/watched.json +0 -29
  101. data/spec/fixtures/repos/watchers.json +0 -8
  102. data/spec/fixtures/users/user.json +0 -32
  103. data/spec/github/api_spec.rb +0 -25
  104. data/spec/github/authorization_spec.rb +0 -176
  105. data/spec/github/authorizations_spec.rb +0 -242
  106. data/spec/github/client_spec.rb +0 -50
  107. data/spec/github/core_ext/hash_spec.rb +0 -44
  108. data/spec/github/events_spec.rb +0 -491
  109. data/spec/github/gists/comments_spec.rb +0 -5
  110. data/spec/github/gists_spec.rb +0 -5
  111. data/spec/github/git_data/blobs_spec.rb +0 -5
  112. data/spec/github/git_data/commits_spec.rb +0 -5
  113. data/spec/github/git_data/references_spec.rb +0 -5
  114. data/spec/github/git_data/tags_spec.rb +0 -5
  115. data/spec/github/git_data/trees_spec.rb +0 -5
  116. data/spec/github/git_data_spec.rb +0 -5
  117. data/spec/github/issues/comments_spec.rb +0 -5
  118. data/spec/github/issues/events_spec.rb +0 -5
  119. data/spec/github/issues/labels_spec.rb +0 -5
  120. data/spec/github/issues/milestones_spec.rb +0 -5
  121. data/spec/github/issues_spec.rb +0 -287
  122. data/spec/github/mime_type_spec.rb +0 -70
  123. data/spec/github/orgs/members_spec.rb +0 -275
  124. data/spec/github/orgs/teams_spec.rb +0 -563
  125. data/spec/github/orgs_spec.rb +0 -160
  126. data/spec/github/repos/collaborators_spec.rb +0 -169
  127. data/spec/github/repos/commits_spec.rb +0 -424
  128. data/spec/github/repos/downloads_spec.rb +0 -236
  129. data/spec/github/repos/forks_spec.rb +0 -103
  130. data/spec/github/repos/hooks_spec.rb +0 -307
  131. data/spec/github/repos/keys_spec.rb +0 -216
  132. data/spec/github/repos/pub_sub_hubbub_spec.rb +0 -83
  133. data/spec/github/repos/watching_spec.rb +0 -222
  134. data/spec/github/repos_spec.rb +0 -571
  135. data/spec/github/result_spec.rb +0 -43
  136. data/spec/github/users_spec.rb +0 -140
  137. data/spec/github_spec.rb +0 -109
  138. data/spec/spec_helper.rb +0 -86
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Github::Client do
4
-
5
- let(:github) { Github.new }
6
-
7
- it "should return Github::Gists instance" do
8
- github.gists.should be_a Github::Gists
9
- end
10
-
11
- it "should return Github::GitData instance" do
12
- github.git_data.should be_a Github::GitData
13
- end
14
-
15
- it "should return Github::Issues instance" do
16
- github.issues.should be_a Github::Issues
17
- end
18
-
19
- it "should return Github::Orgs instance" do
20
- github.orgs.should be_a Github::Orgs
21
- end
22
-
23
- it "should return Github::PullRequests instance" do
24
- github.pull_requests.should be_a Github::PullRequests
25
- end
26
-
27
- it "should return Github::Repos instance" do
28
- github.repos.should be_a Github::Repos
29
- end
30
-
31
- it "should return Github::Users instance" do
32
- github.users.should be_a Github::Users
33
- end
34
-
35
- it "should respond to repos" do
36
- github.should respond_to :repos
37
- end
38
-
39
- it "should respond to repositories" do
40
- github.should respond_to :repositories
41
- end
42
-
43
- it "should respond to git_data" do
44
- github.should respond_to :git_data
45
- end
46
-
47
- it "should respond to git" do
48
- github.should respond_to :git
49
- end
50
- end
@@ -1,44 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Hash do
4
-
5
- before do
6
- Github.new
7
- @hash = { :a => 1, :b => 2, :c => 'e'}
8
- @serialized = "a=1&b=2&c=e"
9
- @nested_hash = { 'a' => { 'b' => {'c' => 1 } } }
10
- @symbols = { :a => { :b => { :c => 1 } } }
11
- end
12
-
13
- it "should respond to except" do
14
- @nested_hash.should respond_to :except
15
- end
16
-
17
- it "should respond to except!" do
18
- @nested_hash.should respond_to :except!
19
- end
20
-
21
- it "should respond to symbolize_keys!" do
22
- @nested_hash.should respond_to :symbolize_keys!
23
- end
24
-
25
- it "should respond to symbolize_keys" do
26
- @nested_hash.should respond_to :symbolize_keys
27
- end
28
-
29
- it "should respond to serialize" do
30
- @nested_hash.should respond_to :serialize
31
- end
32
-
33
- it "should remove key from the hash" do
34
- @nested_hash.except('a').should be_empty
35
- end
36
-
37
- it "should convert nested keys to symbols" do
38
- @nested_hash.symbolize_keys!.should == @symbols
39
- end
40
-
41
- it "should serialize hash" do
42
- @hash.serialize.should == @serialized
43
- end
44
- end
@@ -1,491 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Github::Events do
4
-
5
- let(:github) { Github.new }
6
- let(:user) { 'peter-murach' }
7
- let(:repo) { 'github' }
8
-
9
- describe "public" do
10
- context "resource found" do
11
- before do
12
- stub_get("/events").
13
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
14
- end
15
-
16
- it "should get the resources" do
17
- github.events.public
18
- a_get("/events").should have_been_made
19
- end
20
-
21
- it "should return array of resources" do
22
- events = github.events.public
23
- events.should be_an Array
24
- events.should have(1).items
25
- end
26
-
27
- it "should be a mash type" do
28
- events = github.events.public
29
- events.first.should be_a Hashie::Mash
30
- end
31
-
32
- it "should get event information" do
33
- events = github.events.public
34
- events.first.type.should == 'Event'
35
- end
36
-
37
- it "should yield to a block" do
38
- github.events.should_receive(:public).and_yield('web')
39
- github.events.public { |param| 'web' }
40
- end
41
- end
42
-
43
- context "resource not found" do
44
- before do
45
- stub_get("/events").to_return(:body => "", :status => [404, "Not Found"])
46
- end
47
-
48
- it "should return 404 with a message 'Not Found'" do
49
- expect {
50
- github.events.public
51
- }.to raise_error(Github::ResourceNotFound)
52
- end
53
- end
54
- end # public_events
55
-
56
- describe "repository" do
57
- context "resource found" do
58
- before do
59
- stub_get("/repos/#{user}/#{repo}/events").
60
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
61
- end
62
-
63
- it "should fail to get resource without username" do
64
- github.user, github.repo = nil, nil
65
- expect { github.events.repository nil, repo }.to raise_error(ArgumentError)
66
- end
67
-
68
- it "should get the resources" do
69
- github.events.repository user, repo
70
- a_get("/repos/#{user}/#{repo}/events").should have_been_made
71
- end
72
-
73
- it "should return array of resources" do
74
- events = github.events.repository user, repo
75
- events.should be_an Array
76
- events.should have(1).items
77
- end
78
-
79
- it "should be a mash type" do
80
- events = github.events.repository user, repo
81
- events.first.should be_a Hashie::Mash
82
- end
83
-
84
- it "should get event information" do
85
- events = github.events.repository user, repo
86
- events.first.type.should == 'Event'
87
- end
88
-
89
- it "should yield to a block" do
90
- github.events.should_receive(:repository).with(user, repo).and_yield('web')
91
- github.events.repository(user, repo) { |param| 'web' }
92
- end
93
- end
94
-
95
- context "resource not found" do
96
- before do
97
- stub_get("/repos/#{user}/#{repo}/events").
98
- to_return(:body => "", :status => [404, "Not Found"])
99
- end
100
-
101
- it "should return 404 with a message 'Not Found'" do
102
- expect {
103
- github.events.repository user, repo
104
- }.to raise_error(Github::ResourceNotFound)
105
- end
106
- end
107
- end # repository
108
-
109
- describe "issue" do
110
- context "resource found" do
111
- before do
112
- stub_get("/repos/#{user}/#{repo}/issues/events").
113
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
114
- end
115
-
116
- it "should fail to get resource without username" do
117
- github.user, github.repo = nil, nil
118
- expect { github.events.issue nil, repo }.to raise_error(ArgumentError)
119
- end
120
-
121
- it "should get the resources" do
122
- github.events.issue user, repo
123
- a_get("/repos/#{user}/#{repo}/issues/events").should have_been_made
124
- end
125
-
126
- it "should return array of resources" do
127
- events = github.events.issue user, repo
128
- events.should be_an Array
129
- events.should have(1).items
130
- end
131
-
132
- it "should be a mash type" do
133
- events = github.events.issue user, repo
134
- events.first.should be_a Hashie::Mash
135
- end
136
-
137
- it "should get event information" do
138
- events = github.events.issue user, repo
139
- events.first.type.should == 'Event'
140
- end
141
-
142
- it "should yield to a block" do
143
- github.events.should_receive(:issue).with(user, repo).and_yield('web')
144
- github.events.issue(user, repo) { |param| 'web' }
145
- end
146
- end
147
-
148
- context "resource not found" do
149
- before do
150
- stub_get("/repos/#{user}/#{repo}/issues/events").
151
- to_return(:body => "", :status => [404, "Not Found"])
152
- end
153
-
154
- it "should return 404 with a message 'Not Found'" do
155
- expect {
156
- github.events.issue user, repo
157
- }.to raise_error(Github::ResourceNotFound)
158
- end
159
- end
160
- end # repository
161
-
162
- describe "network" do
163
- context "resource found" do
164
- before do
165
- stub_get("/networks/#{user}/#{repo}/events").
166
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
167
- end
168
-
169
- it "should fail to get resource without username" do
170
- github.user, github.repo = nil, nil
171
- expect { github.events.network nil, repo }.to raise_error(ArgumentError)
172
- end
173
-
174
- it "should get the resources" do
175
- github.events.network user, repo
176
- a_get("/networks/#{user}/#{repo}/events").should have_been_made
177
- end
178
-
179
- it "should return array of resources" do
180
- events = github.events.network user, repo
181
- events.should be_an Array
182
- events.should have(1).items
183
- end
184
-
185
- it "should be a mash type" do
186
- events = github.events.network user, repo
187
- events.first.should be_a Hashie::Mash
188
- end
189
-
190
- it "should get event information" do
191
- events = github.events.network user, repo
192
- events.first.type.should == 'Event'
193
- end
194
-
195
- it "should yield to a block" do
196
- github.events.should_receive(:network).with(user, repo).and_yield('web')
197
- github.events.network(user, repo) { |param| 'web' }
198
- end
199
- end
200
-
201
- context "resource not found" do
202
- before do
203
- stub_get("/networks/#{user}/#{repo}/events").
204
- to_return(:body => "", :status => [404, "Not Found"])
205
- end
206
-
207
- it "should return 404 with a message 'Not Found'" do
208
- expect {
209
- github.events.network user, repo
210
- }.to raise_error(Github::ResourceNotFound)
211
- end
212
- end
213
- end # network
214
-
215
- describe "org" do
216
- let(:org) { 'github' }
217
- context "resource found" do
218
- before do
219
- stub_get("/orgs/#{org}/events").
220
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
221
- end
222
-
223
- it "should fail to get resource without orgname" do
224
- expect { github.events.org nil }.to raise_error(ArgumentError)
225
- end
226
-
227
- it "should get the resources" do
228
- github.events.org org
229
- a_get("/orgs/#{org}/events").should have_been_made
230
- end
231
-
232
- it "should return array of resources" do
233
- events = github.events.org org
234
- events.should be_an Array
235
- events.should have(1).items
236
- end
237
-
238
- it "should be a mash type" do
239
- events = github.events.org org
240
- events.first.should be_a Hashie::Mash
241
- end
242
-
243
- it "should get event information" do
244
- events = github.events.org org
245
- events.first.type.should == 'Event'
246
- end
247
-
248
- it "should yield to a block" do
249
- github.events.should_receive(:org).with(org).and_yield('web')
250
- github.events.org(org) { |param| 'web' }
251
- end
252
- end
253
-
254
- context "resource not found" do
255
- before do
256
- stub_get("/orgs/#{org}/events").
257
- to_return(:body => "", :status => [404, "Not Found"])
258
- end
259
-
260
- it "should return 404 with a message 'Not Found'" do
261
- expect {
262
- github.events.org org
263
- }.to raise_error(Github::ResourceNotFound)
264
- end
265
- end
266
- end # org
267
-
268
- describe "received" do
269
- context "resource found" do
270
- before do
271
- stub_get("/users/#{user}/received_events").
272
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
273
- end
274
-
275
- it "should fail to get resource without username" do
276
- expect { github.events.received nil }.to raise_error(ArgumentError)
277
- end
278
-
279
- it "should get the resources" do
280
- github.events.received user
281
- a_get("/users/#{user}/received_events").should have_been_made
282
- end
283
-
284
- it "should return array of resources" do
285
- events = github.events.received user
286
- events.should be_an Array
287
- events.should have(1).items
288
- end
289
-
290
- it "should be a mash type" do
291
- events = github.events.received user
292
- events.first.should be_a Hashie::Mash
293
- end
294
-
295
- it "should get event information" do
296
- events = github.events.received user
297
- events.first.type.should == 'Event'
298
- end
299
-
300
- it "should yield to a block" do
301
- github.events.should_receive(:received).with(user).and_yield('web')
302
- github.events.received(user) { |param| 'web' }
303
- end
304
- end
305
-
306
- context "all public resources found" do
307
- before do
308
- stub_get("/users/#{user}/received_events/public").
309
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
310
- end
311
-
312
- it "should get the resources" do
313
- github.events.received user, :public => true
314
- a_get("/users/#{user}/received_events/public").should have_been_made
315
- end
316
-
317
- it "should return array of resources" do
318
- events = github.events.received user, :public => true
319
- events.should be_an Array
320
- events.should have(1).items
321
- end
322
-
323
- it "should be a mash type" do
324
- events = github.events.received user, :public => true
325
- events.first.should be_a Hashie::Mash
326
- end
327
-
328
- it "should get event information" do
329
- events = github.events.received user, :public => true
330
- events.first.type.should == 'Event'
331
- end
332
-
333
- it "should yield to a block" do
334
- github.events.should_receive(:received).with(user).and_yield('web')
335
- github.events.received(user) { |param| 'web' }
336
- end
337
- end
338
-
339
- context "resource not found" do
340
- before do
341
- stub_get("/users/#{user}/received_events").
342
- to_return(:body => "", :status => [404, "Not Found"])
343
- end
344
-
345
- it "should return 404 with a message 'Not Found'" do
346
- expect {
347
- github.events.received user
348
- }.to raise_error(Github::ResourceNotFound)
349
- end
350
- end
351
- end # received
352
-
353
- describe "performed" do
354
- context "resource found" do
355
- before do
356
- stub_get("/users/#{user}/events").
357
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
358
- end
359
-
360
- it "should fail to get resource without username" do
361
- expect { github.events.performed nil }.to raise_error(ArgumentError)
362
- end
363
-
364
- it "should get the resources" do
365
- github.events.performed user
366
- a_get("/users/#{user}/events").should have_been_made
367
- end
368
-
369
- it "should return array of resources" do
370
- events = github.events.performed user
371
- events.should be_an Array
372
- events.should have(1).items
373
- end
374
-
375
- it "should be a mash type" do
376
- events = github.events.performed user
377
- events.first.should be_a Hashie::Mash
378
- end
379
-
380
- it "should get event information" do
381
- events = github.events.performed user
382
- events.first.type.should == 'Event'
383
- end
384
-
385
- it "should yield to a block" do
386
- github.events.should_receive(:performed).with(user).and_yield('web')
387
- github.events.performed(user) { |param| 'web' }
388
- end
389
- end
390
-
391
- context "all public resources found" do
392
- before do
393
- stub_get("/users/#{user}/events/public").
394
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
395
- end
396
-
397
- it "should get the resources" do
398
- github.events.performed user, :public => true
399
- a_get("/users/#{user}/events/public").should have_been_made
400
- end
401
-
402
- it "should return array of resources" do
403
- events = github.events.performed user, :public => true
404
- events.should be_an Array
405
- events.should have(1).items
406
- end
407
-
408
- it "should be a mash type" do
409
- events = github.events.performed user, :public => true
410
- events.first.should be_a Hashie::Mash
411
- end
412
-
413
- it "should get event information" do
414
- events = github.events.performed user, :public => true
415
- events.first.type.should == 'Event'
416
- end
417
-
418
- it "should yield to a block" do
419
- github.events.should_receive(:performed).with(user).and_yield('web')
420
- github.events.performed(user) { |param| 'web' }
421
- end
422
- end
423
-
424
- context "resource not found" do
425
- before do
426
- stub_get("/users/#{user}/events").
427
- to_return(:body => "", :status => [404, "Not Found"])
428
- end
429
-
430
- it "should return 404 with a message 'Not Found'" do
431
- expect {
432
- github.events.performed user
433
- }.to raise_error(Github::ResourceNotFound)
434
- end
435
- end
436
- end # performed
437
-
438
- describe "user_org" do
439
- let(:org) { 'github' }
440
- context "resource found" do
441
- before do
442
- stub_get("/users/#{user}/events/orgs/#{org}").
443
- to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
444
- end
445
-
446
- it "should fail to get resource without orgname" do
447
- expect { github.events.user_org user, nil }.to raise_error(ArgumentError)
448
- end
449
-
450
- it "should get the resources" do
451
- github.events.user_org user, org
452
- a_get("/users/#{user}/events/orgs/#{org}").should have_been_made
453
- end
454
-
455
- it "should return array of resources" do
456
- events = github.events.user_org user, org
457
- events.should be_an Array
458
- events.should have(1).items
459
- end
460
-
461
- it "should be a mash type" do
462
- events = github.events.user_org user, org
463
- events.first.should be_a Hashie::Mash
464
- end
465
-
466
- it "should get event information" do
467
- events = github.events.user_org user, org
468
- events.first.type.should == 'Event'
469
- end
470
-
471
- it "should yield to a block" do
472
- github.events.should_receive(:user_org).with(user, org).and_yield('web')
473
- github.events.user_org(user, org) { |param| 'web' }
474
- end
475
- end
476
-
477
- context "resource not found" do
478
- before do
479
- stub_get("/users/#{user}/events/orgs/#{org}").
480
- to_return(:body => "", :status => [404, "Not Found"])
481
- end
482
-
483
- it "should return 404 with a message 'Not Found'" do
484
- expect {
485
- github.events.user_org user, org
486
- }.to raise_error(Github::ResourceNotFound)
487
- end
488
- end
489
- end # user_org
490
-
491
- end # Github::Events