github_api 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +6 -5
- data/features/{events.feature → activity/events.feature} +8 -8
- data/features/{repos → activity}/starring.feature +6 -6
- data/features/{repos → activity}/watching.feature +6 -6
- data/features/cassettes/{events → activity/events}/issue.yml +0 -0
- data/features/cassettes/{events → activity/events}/network.yml +0 -0
- data/features/cassettes/{events → activity/events}/org.yml +0 -0
- data/features/cassettes/{events → activity/events}/performed.yml +0 -0
- data/features/cassettes/{events → activity/events}/public.yml +0 -0
- data/features/cassettes/{events → activity/events}/received.yml +0 -0
- data/features/cassettes/{events → activity/events}/repo.yml +0 -0
- data/features/cassettes/{events → activity/events}/user_org.yml +0 -0
- data/features/cassettes/{repos → activity}/starring/list.yml +0 -0
- data/features/cassettes/{repos → activity}/starring/star.yml +0 -0
- data/features/cassettes/{repos → activity}/starring/starred.yml +0 -0
- data/features/cassettes/{repos → activity}/starring/starring.yml +0 -0
- data/features/cassettes/{repos → activity}/starring/unstar.yml +0 -0
- data/features/cassettes/{repos → activity}/watching/list.yml +0 -0
- data/features/cassettes/{repos → activity}/watching/unwatch.yml +0 -0
- data/features/cassettes/{repos → activity}/watching/watch.yml +0 -0
- data/features/cassettes/{repos → activity}/watching/watched.yml +0 -0
- data/features/cassettes/{repos → activity}/watching/watching.yml +0 -0
- data/features/github_api.feature +3 -3
- data/lib/github_api.rb +1 -1
- data/lib/github_api/activity.rb +39 -0
- data/lib/github_api/{events.rb → activity/events.rb} +5 -5
- data/lib/github_api/activity/notifications.rb +162 -0
- data/lib/github_api/{repos → activity}/starring.rb +9 -9
- data/lib/github_api/{repos → activity}/watching.rb +9 -9
- data/lib/github_api/client.rb +6 -4
- data/lib/github_api/repos.rb +2 -14
- data/lib/github_api/response.rb +0 -1
- data/lib/github_api/version.rb +2 -2
- data/spec/fixtures/activity/notifications.json +32 -0
- data/spec/fixtures/activity/subscribed.json +8 -0
- data/spec/fixtures/activity/threads.json +32 -0
- data/spec/github/activity/activity_spec.rb +16 -0
- data/spec/github/activity/events/issue_spec.rb +63 -0
- data/spec/github/activity/events/network_spec.rb +61 -0
- data/spec/github/activity/events/org_spec.rb +60 -0
- data/spec/github/activity/events/performed_spec.rb +91 -0
- data/spec/github/activity/events/public_spec.rb +55 -0
- data/spec/github/activity/events/received_spec.rb +91 -0
- data/spec/github/activity/events/repository_spec.rb +65 -0
- data/spec/github/activity/events/user_org_spec.rb +63 -0
- data/spec/github/activity/notifications/create_spec.rb +44 -0
- data/spec/github/activity/notifications/delete_spec.rb +41 -0
- data/spec/github/activity/notifications/get_spec.rb +58 -0
- data/spec/github/activity/notifications/list_spec.rb +82 -0
- data/spec/github/activity/notifications/mark_spec.rb +74 -0
- data/spec/github/activity/notifications/subscribed_spec.rb +48 -0
- data/spec/github/activity/starring/list_spec.rb +64 -0
- data/spec/github/activity/starring/star_spec.rb +36 -0
- data/spec/github/activity/starring/starred_spec.rb +53 -0
- data/spec/github/activity/starring/starring_spec.rb +38 -0
- data/spec/github/activity/starring/unstar_spec.rb +37 -0
- data/spec/github/activity/watching/list_spec.rb +59 -0
- data/spec/github/activity/watching/unwatch_spec.rb +37 -0
- data/spec/github/activity/watching/watch_spec.rb +37 -0
- data/spec/github/activity/watching/watched_spec.rb +53 -0
- data/spec/github/activity/watching/watching_spec.rb +41 -0
- data/spec/github/authorization_spec.rb +2 -2
- data/spec/github/issues_spec.rb +1 -1
- data/spec/github/repos/comments/delete_spec.rb +2 -0
- data/spec/github/repos/delete_spec.rb +1 -1
- data/spec/github/repos/get_spec.rb +2 -2
- data/spec/github/repos/starring_spec.rb +0 -199
- data/spec/github/repos_spec.rb +0 -4
- data/spec/github/result_spec.rb +1 -1
- metadata +88 -62
- data/features/cassettes/git_data/tags/get.yml +0 -54
- data/features/git_data/tags.feature +0 -17
- data/spec/github/events_spec.rb +0 -491
- data/spec/github/repos/watching_spec.rb +0 -203
@@ -1,17 +0,0 @@
|
|
1
|
-
Feature: Tags API
|
2
|
-
|
3
|
-
In order to interact with github git data references
|
4
|
-
GithubAPI gem
|
5
|
-
Should return the expected results depending on passed parameters
|
6
|
-
|
7
|
-
Background:
|
8
|
-
Given I have "Github::GitData::Tags" instance
|
9
|
-
|
10
|
-
# Scenario: Lists all tags on a repository
|
11
|
-
# Given I want to get resource with the following params:
|
12
|
-
# | user | repo | sha |
|
13
|
-
# | wycats | thor | 54cbeb8591609aa949212c8988a08741008c9ade |
|
14
|
-
# When I make request within a cassette named "git_data/tags/get"
|
15
|
-
# Then the response status should be 200
|
16
|
-
# And the response type should be JSON
|
17
|
-
# And the response should not be empty
|
data/spec/github/events_spec.rb
DELETED
@@ -1,491 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Github::Events do
|
6
|
-
let(:github) { Github.new }
|
7
|
-
let(:user) { 'peter-murach' }
|
8
|
-
let(:repo) { 'github' }
|
9
|
-
|
10
|
-
after { github.user, github.repo, github.oauth_token = nil, nil, nil }
|
11
|
-
|
12
|
-
describe "public" do
|
13
|
-
context "resource found" do
|
14
|
-
before do
|
15
|
-
stub_get("/events").
|
16
|
-
to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should get the resources" do
|
20
|
-
github.events.public
|
21
|
-
a_get("/events").should have_been_made
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should return array of resources" do
|
25
|
-
events = github.events.public
|
26
|
-
events.should be_an Array
|
27
|
-
events.should have(1).items
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should be a mash type" do
|
31
|
-
events = github.events.public
|
32
|
-
events.first.should be_a Hashie::Mash
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should get event information" do
|
36
|
-
events = github.events.public
|
37
|
-
events.first.type.should == 'Event'
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should yield to a block" do
|
41
|
-
github.events.should_receive(:public).and_yield('web')
|
42
|
-
github.events.public { |param| 'web' }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context "resource not found" do
|
47
|
-
before do
|
48
|
-
stub_get("/events").to_return(:body => "", :status => [404, "Not Found"])
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should return 404 with a message 'Not Found'" do
|
52
|
-
expect {
|
53
|
-
github.events.public
|
54
|
-
}.to raise_error(Github::Error::NotFound)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end # public_events
|
58
|
-
|
59
|
-
describe "repository" do
|
60
|
-
context "resource found" do
|
61
|
-
before do
|
62
|
-
stub_get("/repos/#{user}/#{repo}/events").
|
63
|
-
to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should fail to get resource without username" do
|
67
|
-
expect { github.events.repository nil, repo }.to raise_error(ArgumentError)
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should get the resources" do
|
71
|
-
github.events.repository user, repo
|
72
|
-
a_get("/repos/#{user}/#{repo}/events").should have_been_made
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should return array of resources" do
|
76
|
-
events = github.events.repository user, repo
|
77
|
-
events.should be_an Array
|
78
|
-
events.should have(1).items
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should be a mash type" do
|
82
|
-
events = github.events.repository user, repo
|
83
|
-
events.first.should be_a Hashie::Mash
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should get event information" do
|
87
|
-
events = github.events.repository user, repo
|
88
|
-
events.first.type.should == 'Event'
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should yield to a block" do
|
92
|
-
github.events.should_receive(:repository).with(user, repo).and_yield('web')
|
93
|
-
github.events.repository(user, repo) { |param| 'web' }
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context "resource not found" do
|
98
|
-
before do
|
99
|
-
stub_get("/repos/#{user}/#{repo}/events").
|
100
|
-
to_return(:body => "", :status => [404, "Not Found"])
|
101
|
-
end
|
102
|
-
|
103
|
-
it "should return 404 with a message 'Not Found'" do
|
104
|
-
expect {
|
105
|
-
github.events.repository user, repo
|
106
|
-
}.to raise_error(Github::Error::NotFound)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end # repository
|
110
|
-
|
111
|
-
describe "issue" do
|
112
|
-
context "resource found" do
|
113
|
-
before do
|
114
|
-
stub_get("/repos/#{user}/#{repo}/issues/events").
|
115
|
-
to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
|
116
|
-
end
|
117
|
-
|
118
|
-
it "should fail to get resource without username" do
|
119
|
-
expect { github.events.issue nil, repo }.to raise_error(ArgumentError)
|
120
|
-
end
|
121
|
-
|
122
|
-
it "should get the resources" do
|
123
|
-
github.events.issue user, repo
|
124
|
-
a_get("/repos/#{user}/#{repo}/issues/events").should have_been_made
|
125
|
-
end
|
126
|
-
|
127
|
-
it "should return array of resources" do
|
128
|
-
events = github.events.issue user, repo
|
129
|
-
events.should be_an Array
|
130
|
-
events.should have(1).items
|
131
|
-
end
|
132
|
-
|
133
|
-
it "should be a mash type" do
|
134
|
-
events = github.events.issue user, repo
|
135
|
-
events.first.should be_a Hashie::Mash
|
136
|
-
end
|
137
|
-
|
138
|
-
it "should get event information" do
|
139
|
-
events = github.events.issue user, repo
|
140
|
-
events.first.type.should == 'Event'
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should yield to a block" do
|
144
|
-
github.events.should_receive(:issue).with(user, repo).and_yield('web')
|
145
|
-
github.events.issue(user, repo) { |param| 'web' }
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
context "resource not found" do
|
150
|
-
before do
|
151
|
-
stub_get("/repos/#{user}/#{repo}/issues/events").
|
152
|
-
to_return(:body => "", :status => [404, "Not Found"])
|
153
|
-
end
|
154
|
-
|
155
|
-
it "should return 404 with a message 'Not Found'" do
|
156
|
-
expect {
|
157
|
-
github.events.issue user, repo
|
158
|
-
}.to raise_error(Github::Error::NotFound)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end # repository
|
162
|
-
|
163
|
-
describe "network" do
|
164
|
-
context "resource found" do
|
165
|
-
before do
|
166
|
-
stub_get("/networks/#{user}/#{repo}/events").
|
167
|
-
to_return(:body => fixture('events/events.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
|
168
|
-
end
|
169
|
-
|
170
|
-
it "should fail to get resource without username" do
|
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::Error::NotFound)
|
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::Error::NotFound)
|
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::Error::NotFound)
|
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::Error::NotFound)
|
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::Error::NotFound)
|
487
|
-
end
|
488
|
-
end
|
489
|
-
end # user_org
|
490
|
-
|
491
|
-
end # Github::Events
|