lita-github_pr_list 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.hound.yml +8 -0
  4. data/.rspec +4 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +21 -0
  7. data/README.md +51 -0
  8. data/Rakefile +6 -0
  9. data/bin/rake +16 -0
  10. data/bin/rspec +16 -0
  11. data/lib/lita/github_pr_list/alias_user.rb +19 -0
  12. data/lib/lita/github_pr_list/comment_hook.rb +42 -0
  13. data/lib/lita/github_pr_list/pull_request.rb +62 -0
  14. data/lib/lita/github_pr_list/status.rb +44 -0
  15. data/lib/lita/github_pr_list/version.rb +5 -0
  16. data/lib/lita/github_pr_list/web_hook.rb +39 -0
  17. data/lib/lita/github_pr_list.rb +7 -0
  18. data/lib/lita/handlers/github_pr_list.rb +91 -0
  19. data/lita-github_pr_list.gemspec +30 -0
  20. data/spec/fixtures/issue_comment_event_failed.json +180 -0
  21. data/spec/fixtures/issue_comment_event_fixed.json +180 -0
  22. data/spec/fixtures/issue_comment_event_in_review.json +180 -0
  23. data/spec/fixtures/issue_comment_event_passed.json +180 -0
  24. data/spec/fixtures/issue_comments_failed.json +83 -0
  25. data/spec/fixtures/issue_comments_fixed.json +111 -0
  26. data/spec/fixtures/issue_comments_in_review.json +83 -0
  27. data/spec/fixtures/issue_comments_new.json +56 -0
  28. data/spec/fixtures/issue_comments_passed.json +83 -0
  29. data/spec/fixtures/one_org_issue_list.json +182 -0
  30. data/spec/fixtures/repository_hooks.json +34 -0
  31. data/spec/fixtures/repository_list.json +108 -0
  32. data/spec/fixtures/two_org_issue_list.json +362 -0
  33. data/spec/lita/handlers/alias_spec.rb +13 -0
  34. data/spec/lita/handlers/comment_hook_spec.rb +57 -0
  35. data/spec/lita/handlers/pull_request_spec.rb +72 -0
  36. data/spec/lita/handlers/web_hook_spec.rb +50 -0
  37. data/spec/spec_helper.rb +8 -0
  38. metadata +222 -0
@@ -0,0 +1,362 @@
1
+ [
2
+ {
3
+ "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
4
+ "html_url": "https://github.com/octocat/Hello-World/issues/1347",
5
+ "number": 1347,
6
+ "state": "open",
7
+ "title": "Found a bug",
8
+ "body": "I'm having a problem with this.",
9
+ "user": {
10
+ "login": "octocat",
11
+ "id": 1,
12
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
13
+ "gravatar_id": "somehexcode",
14
+ "url": "https://api.github.com/users/octocat",
15
+ "html_url": "https://github.com/octocat",
16
+ "followers_url": "https://api.github.com/users/octocat/followers",
17
+ "following_url": "https://api.github.com/users/octocat/following{/other_user}",
18
+ "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
19
+ "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
20
+ "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
21
+ "organizations_url": "https://api.github.com/users/octocat/orgs",
22
+ "repos_url": "https://api.github.com/users/octocat/repos",
23
+ "events_url": "https://api.github.com/users/octocat/events{/privacy}",
24
+ "received_events_url": "https://api.github.com/users/octocat/received_events",
25
+ "type": "User",
26
+ "site_admin": false
27
+ },
28
+ "labels": [
29
+ {
30
+ "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
31
+ "name": "bug",
32
+ "color": "f29513"
33
+ }
34
+ ],
35
+ "assignee": {
36
+ "login": "octocat",
37
+ "id": 1,
38
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
39
+ "gravatar_id": "somehexcode",
40
+ "url": "https://api.github.com/users/octocat",
41
+ "html_url": "https://github.com/octocat",
42
+ "followers_url": "https://api.github.com/users/octocat/followers",
43
+ "following_url": "https://api.github.com/users/octocat/following{/other_user}",
44
+ "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
45
+ "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
46
+ "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
47
+ "organizations_url": "https://api.github.com/users/octocat/orgs",
48
+ "repos_url": "https://api.github.com/users/octocat/repos",
49
+ "events_url": "https://api.github.com/users/octocat/events{/privacy}",
50
+ "received_events_url": "https://api.github.com/users/octocat/received_events",
51
+ "type": "User",
52
+ "site_admin": false
53
+ },
54
+ "milestone": {
55
+ "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
56
+ "number": 1,
57
+ "state": "open",
58
+ "title": "v1.0",
59
+ "description": "",
60
+ "creator": {
61
+ "login": "octocat",
62
+ "id": 1,
63
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
64
+ "gravatar_id": "somehexcode",
65
+ "url": "https://api.github.com/users/octocat",
66
+ "html_url": "https://github.com/octocat",
67
+ "followers_url": "https://api.github.com/users/octocat/followers",
68
+ "following_url": "https://api.github.com/users/octocat/following{/other_user}",
69
+ "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
70
+ "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
71
+ "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
72
+ "organizations_url": "https://api.github.com/users/octocat/orgs",
73
+ "repos_url": "https://api.github.com/users/octocat/repos",
74
+ "events_url": "https://api.github.com/users/octocat/events{/privacy}",
75
+ "received_events_url": "https://api.github.com/users/octocat/received_events",
76
+ "type": "User",
77
+ "site_admin": false
78
+ },
79
+ "open_issues": 4,
80
+ "closed_issues": 8,
81
+ "created_at": "2011-04-10T20:09:31Z",
82
+ "updated_at": "2014-03-03T18:58:10Z",
83
+ "due_on": null
84
+ },
85
+ "comments": 0,
86
+ "pull_request": {
87
+ "url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
88
+ "html_url": "https://github.com/octocat/Hello-World/pull/1347",
89
+ "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
90
+ "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
91
+ },
92
+ "closed_at": null,
93
+ "created_at": "2011-04-22T13:33:48Z",
94
+ "updated_at": "2011-04-22T13:33:48Z",
95
+ "repository": {
96
+ "id": 123456789,
97
+ "name": "waffles",
98
+ "full_name": "wafflesausages111111/batman_robin",
99
+ "owner": {
100
+ "login": "wafflesausages111111",
101
+ "id": 111111,
102
+ "avatar_url": "https://avatars.githubusercontent.com/u/123456?",
103
+ "gravatar_id": "2222222222222222222222222222222222222222222",
104
+ "url": "https://api.github.com/users/wafflesausages111111",
105
+ "html_url": "https://github.com/wafflesausages111111",
106
+ "followers_url": "https://api.github.com/users/wafflesausages111111/followers",
107
+ "following_url": "https://api.github.com/users/wafflesausages111111/following{/other_user}",
108
+ "gists_url": "https://api.github.com/users/wafflesausages111111/gists{/gist_id}",
109
+ "starred_url": "https://api.github.com/users/wafflesausages111111/starred{/owner}{/repo}",
110
+ "subscriptions_url": "https://api.github.com/users/wafflesausages111111/subscriptions",
111
+ "organizations_url": "https://api.github.com/users/wafflesausages111111/orgs",
112
+ "repos_url": "https://api.github.com/users/wafflesausages111111/repos",
113
+ "events_url": "https://api.github.com/users/wafflesausages111111/events{/privacy}",
114
+ "received_events_url": "https://api.github.com/users/wafflesausages111111/received_events",
115
+ "type": "Organization",
116
+ "site_admin": false
117
+ },
118
+ "private": true,
119
+ "html_url": "https://github.com/wafflesausages111111/batman_robin",
120
+ "description": "",
121
+ "fork": false,
122
+ "url": "https://api.github.com/repos/wafflesausages111111/batman_robin",
123
+ "forks_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/forks",
124
+ "keys_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/keys{/key_id}",
125
+ "collaborators_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/collaborators{/collaborator}",
126
+ "teams_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/teams",
127
+ "hooks_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/hooks",
128
+ "issue_events_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/issues/events{/number}",
129
+ "events_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/events",
130
+ "assignees_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/assignees{/user}",
131
+ "branches_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/branches{/branch}",
132
+ "tags_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/tags",
133
+ "blobs_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/blobs{/sha}",
134
+ "git_tags_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/tags{/sha}",
135
+ "git_refs_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/refs{/sha}",
136
+ "trees_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/trees{/sha}",
137
+ "statuses_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/statuses/{sha}",
138
+ "languages_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/languages",
139
+ "stargazers_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/stargazers",
140
+ "contributors_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/contributors",
141
+ "subscribers_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/subscribers",
142
+ "subscription_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/subscription",
143
+ "commits_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/commits{/sha}",
144
+ "git_commits_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/commits{/sha}",
145
+ "comments_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/comments{/number}",
146
+ "issue_comment_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/issues/comments/{number}",
147
+ "contents_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/contents/{+path}",
148
+ "compare_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/compare/{base}...{head}",
149
+ "merges_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/merges",
150
+ "archive_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/{archive_format}{/ref}",
151
+ "downloads_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/downloads",
152
+ "issues_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/issues{/number}",
153
+ "pulls_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/pulls{/number}",
154
+ "milestones_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/milestones{/number}",
155
+ "notifications_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/notifications{?since,all,participating}",
156
+ "labels_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/labels{/name}",
157
+ "releases_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/releases{/id}",
158
+ "created_at": "2014-06-23T20:26:50Z",
159
+ "updated_at": "2014-06-24T22:22:38Z",
160
+ "pushed_at": "2014-06-25T17:14:43Z",
161
+ "git_url": "git://github.com/wafflesausages111111/batman_robin.git",
162
+ "ssh_url": "git@github.com:wafflesausages111111/batman_robin.git",
163
+ "clone_url": "https://github.com/wafflesausages111111/batman_robin.git",
164
+ "svn_url": "https://github.com/wafflesausages111111/batman_robin",
165
+ "homepage": null,
166
+ "size": 0,
167
+ "stargazers_count": 0,
168
+ "watchers_count": 0,
169
+ "language": "Ruby",
170
+ "has_issues": true,
171
+ "has_downloads": true,
172
+ "has_wiki": true,
173
+ "forks_count": 0,
174
+ "mirror_url": null,
175
+ "open_issues_count": 1,
176
+ "forks": 0,
177
+ "open_issues": 1,
178
+ "watchers": 0,
179
+ "default_branch": "master"
180
+ }
181
+ },
182
+ {
183
+ "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
184
+ "html_url": "https://github.com/octocat/Hello-World/issues/1347",
185
+ "number": 1347,
186
+ "state": "open",
187
+ "title": "Found a waffle",
188
+ "body": "I'm having a problem with this.",
189
+ "user": {
190
+ "login": "octocat",
191
+ "id": 1,
192
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
193
+ "gravatar_id": "somehexcode",
194
+ "url": "https://api.github.com/users/octocat",
195
+ "html_url": "https://github.com/octocat",
196
+ "followers_url": "https://api.github.com/users/octocat/followers",
197
+ "following_url": "https://api.github.com/users/octocat/following{/other_user}",
198
+ "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
199
+ "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
200
+ "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
201
+ "organizations_url": "https://api.github.com/users/octocat/orgs",
202
+ "repos_url": "https://api.github.com/users/octocat/repos",
203
+ "events_url": "https://api.github.com/users/octocat/events{/privacy}",
204
+ "received_events_url": "https://api.github.com/users/octocat/received_events",
205
+ "type": "User",
206
+ "site_admin": false
207
+ },
208
+ "labels": [
209
+ {
210
+ "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
211
+ "name": "bug",
212
+ "color": "f29513"
213
+ }
214
+ ],
215
+ "assignee": {
216
+ "login": "octocat",
217
+ "id": 1,
218
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
219
+ "gravatar_id": "somehexcode",
220
+ "url": "https://api.github.com/users/octocat",
221
+ "html_url": "https://github.com/octocat",
222
+ "followers_url": "https://api.github.com/users/octocat/followers",
223
+ "following_url": "https://api.github.com/users/octocat/following{/other_user}",
224
+ "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
225
+ "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
226
+ "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
227
+ "organizations_url": "https://api.github.com/users/octocat/orgs",
228
+ "repos_url": "https://api.github.com/users/octocat/repos",
229
+ "events_url": "https://api.github.com/users/octocat/events{/privacy}",
230
+ "received_events_url": "https://api.github.com/users/octocat/received_events",
231
+ "type": "User",
232
+ "site_admin": false
233
+ },
234
+ "milestone": {
235
+ "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
236
+ "number": 1,
237
+ "state": "open",
238
+ "title": "v1.0",
239
+ "description": "",
240
+ "creator": {
241
+ "login": "octocat",
242
+ "id": 1,
243
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
244
+ "gravatar_id": "somehexcode",
245
+ "url": "https://api.github.com/users/octocat",
246
+ "html_url": "https://github.com/octocat",
247
+ "followers_url": "https://api.github.com/users/octocat/followers",
248
+ "following_url": "https://api.github.com/users/octocat/following{/other_user}",
249
+ "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
250
+ "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
251
+ "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
252
+ "organizations_url": "https://api.github.com/users/octocat/orgs",
253
+ "repos_url": "https://api.github.com/users/octocat/repos",
254
+ "events_url": "https://api.github.com/users/octocat/events{/privacy}",
255
+ "received_events_url": "https://api.github.com/users/octocat/received_events",
256
+ "type": "User",
257
+ "site_admin": false
258
+ },
259
+ "open_issues": 4,
260
+ "closed_issues": 8,
261
+ "created_at": "2011-04-10T20:09:31Z",
262
+ "updated_at": "2014-03-03T18:58:10Z",
263
+ "due_on": null
264
+ },
265
+ "comments": 0,
266
+ "pull_request": {
267
+ "url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
268
+ "html_url": "https://github.com/octocat/Hello-World/pull/1347",
269
+ "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
270
+ "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
271
+ },
272
+ "closed_at": null,
273
+ "created_at": "2011-04-22T13:33:48Z",
274
+ "updated_at": "2011-04-22T13:33:48Z",
275
+ "repository": {
276
+ "id": 123456789,
277
+ "name": "waffles",
278
+ "full_name": "wafflesausages111111/batman_robin",
279
+ "owner": {
280
+ "login": "wafflesausages111111",
281
+ "id": 111111,
282
+ "avatar_url": "https://avatars.githubusercontent.com/u/123456?",
283
+ "gravatar_id": "2222222222222222222222222222222222222222222",
284
+ "url": "https://api.github.com/users/wafflesausages111111",
285
+ "html_url": "https://github.com/wafflesausages111111",
286
+ "followers_url": "https://api.github.com/users/wafflesausages111111/followers",
287
+ "following_url": "https://api.github.com/users/wafflesausages111111/following{/other_user}",
288
+ "gists_url": "https://api.github.com/users/wafflesausages111111/gists{/gist_id}",
289
+ "starred_url": "https://api.github.com/users/wafflesausages111111/starred{/owner}{/repo}",
290
+ "subscriptions_url": "https://api.github.com/users/wafflesausages111111/subscriptions",
291
+ "organizations_url": "https://api.github.com/users/wafflesausages111111/orgs",
292
+ "repos_url": "https://api.github.com/users/wafflesausages111111/repos",
293
+ "events_url": "https://api.github.com/users/wafflesausages111111/events{/privacy}",
294
+ "received_events_url": "https://api.github.com/users/wafflesausages111111/received_events",
295
+ "type": "Organization",
296
+ "site_admin": false
297
+ },
298
+ "private": true,
299
+ "html_url": "https://github.com/wafflesausages111111/batman_robin",
300
+ "description": "",
301
+ "fork": false,
302
+ "url": "https://api.github.com/repos/wafflesausages111111/batman_robin",
303
+ "forks_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/forks",
304
+ "keys_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/keys{/key_id}",
305
+ "collaborators_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/collaborators{/collaborator}",
306
+ "teams_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/teams",
307
+ "hooks_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/hooks",
308
+ "issue_events_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/issues/events{/number}",
309
+ "events_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/events",
310
+ "assignees_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/assignees{/user}",
311
+ "branches_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/branches{/branch}",
312
+ "tags_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/tags",
313
+ "blobs_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/blobs{/sha}",
314
+ "git_tags_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/tags{/sha}",
315
+ "git_refs_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/refs{/sha}",
316
+ "trees_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/trees{/sha}",
317
+ "statuses_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/statuses/{sha}",
318
+ "languages_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/languages",
319
+ "stargazers_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/stargazers",
320
+ "contributors_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/contributors",
321
+ "subscribers_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/subscribers",
322
+ "subscription_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/subscription",
323
+ "commits_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/commits{/sha}",
324
+ "git_commits_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/git/commits{/sha}",
325
+ "comments_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/comments{/number}",
326
+ "issue_comment_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/issues/comments/{number}",
327
+ "contents_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/contents/{+path}",
328
+ "compare_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/compare/{base}...{head}",
329
+ "merges_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/merges",
330
+ "archive_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/{archive_format}{/ref}",
331
+ "downloads_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/downloads",
332
+ "issues_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/issues{/number}",
333
+ "pulls_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/pulls{/number}",
334
+ "milestones_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/milestones{/number}",
335
+ "notifications_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/notifications{?since,all,participating}",
336
+ "labels_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/labels{/name}",
337
+ "releases_url": "https://api.github.com/repos/wafflesausages111111/batman_robin/releases{/id}",
338
+ "created_at": "2014-06-23T20:26:50Z",
339
+ "updated_at": "2014-06-24T22:22:38Z",
340
+ "pushed_at": "2014-06-25T17:14:43Z",
341
+ "git_url": "git://github.com/wafflesausages111111/batman_robin.git",
342
+ "ssh_url": "git@github.com:wafflesausages111111/batman_robin.git",
343
+ "clone_url": "https://github.com/wafflesausages111111/batman_robin.git",
344
+ "svn_url": "https://github.com/wafflesausages111111/batman_robin",
345
+ "homepage": null,
346
+ "size": 0,
347
+ "stargazers_count": 0,
348
+ "watchers_count": 0,
349
+ "language": "Ruby",
350
+ "has_issues": true,
351
+ "has_downloads": true,
352
+ "has_wiki": true,
353
+ "forks_count": 0,
354
+ "mirror_url": null,
355
+ "open_issues_count": 1,
356
+ "forks": 0,
357
+ "open_issues": 1,
358
+ "watchers": 0,
359
+ "default_branch": "master"
360
+ }
361
+ }
362
+ ]
@@ -0,0 +1,13 @@
1
+ describe Lita::Handlers::GithubPrList, lita_handler: true do
2
+ before :each do
3
+ Lita.config.handlers.github_pr_list.github_organization = 'aaaaaabbbbbbcccccc'
4
+ Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
5
+ end
6
+
7
+ it "maps the github name to the hipchat username (mention)" do
8
+ send_command("pr alias user mcwaffle mcrib")
9
+
10
+ expect(replies.last).to include("Mapped mcwaffle to mcrib")
11
+ expect(subject.redis.get("alias:mcwaffle")).to include("mcrib")
12
+ end
13
+ end
@@ -0,0 +1,57 @@
1
+ describe Lita::Handlers::GithubPrList, lita_handler: true do
2
+ before :each do
3
+ Lita.config.handlers.github_pr_list.github_organization = 'aaaaaabbbbbbcccccc'
4
+ Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
5
+ end
6
+
7
+ let(:issue_comment_event_passed) { File.read("spec/fixtures/issue_comment_event_passed.json") }
8
+ let(:issue_comment_event_failed) { File.read("spec/fixtures/issue_comment_event_failed.json") }
9
+ let(:issue_comment_event_in_review) { File.read("spec/fixtures/issue_comment_event_in_review.json") }
10
+ let(:issue_comment_event_fixed) { File.read("spec/fixtures/issue_comment_event_fixed.json") }
11
+
12
+ it { routes_http(:post, "/comment_hook").to(:comment_hook) }
13
+
14
+ it "mentions the github user in the room and tell them they passed" do
15
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_passed))
16
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
17
+
18
+ github_handler = Lita::Handlers::GithubPrList.new
19
+ github_handler.comment_hook(request, response)
20
+
21
+ expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has passed."\
22
+ " https://github.com/baxterthehacker/public-repo/issues/47")
23
+ end
24
+
25
+ it "mentions the github user in the room and tell them they failed" do
26
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_failed))
27
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
28
+
29
+ github_handler = Lita::Handlers::GithubPrList.new
30
+ github_handler.comment_hook(request, response)
31
+
32
+ expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has failed."\
33
+ " https://github.com/baxterthehacker/public-repo/issues/47")
34
+ end
35
+
36
+ it "mentions the github user in the room and tell them they are reviewing" do
37
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_in_review))
38
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
39
+
40
+ github_handler = Lita::Handlers::GithubPrList.new
41
+ github_handler.comment_hook(request, response)
42
+
43
+ expect(replies.last).to include("@baxterthehacker is currently reviewing: Spelling error in the README file."\
44
+ " https://github.com/baxterthehacker/public-repo/issues/47")
45
+ end
46
+
47
+ it "mentions the github user in the room and tell them it has been fixed" do
48
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_fixed))
49
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
50
+
51
+ github_handler = Lita::Handlers::GithubPrList.new
52
+ github_handler.comment_hook(request, response)
53
+
54
+ expect(replies.last).to include("Spelling error in the README file has been fixed:"\
55
+ " https://github.com/baxterthehacker/public-repo/issues/47")
56
+ end
57
+ end
@@ -0,0 +1,72 @@
1
+ require 'json'
2
+
3
+ describe Lita::Handlers::GithubPrList, lita_handler: true do
4
+ before :each do
5
+ Lita.config.handlers.github_pr_list.github_organization = 'aaaaaabbbbbbcccccc'
6
+ Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
7
+ end
8
+
9
+ let(:agent) do
10
+ Sawyer::Agent.new "http://example.com/a/" do |conn|
11
+ conn.builder.handlers.delete(Faraday::Adapter::NetHttp)
12
+ conn.adapter :test, Faraday::Adapter::Test::Stubs.new
13
+ end
14
+ end
15
+
16
+ def sawyer_resource_array(file_path)
17
+ resources = []
18
+ JSON.parse(File.read(file_path)).each do |i|
19
+ resources << Sawyer::Resource.new(agent, i)
20
+ end
21
+
22
+ resources
23
+ end
24
+
25
+ let(:one_issue) { sawyer_resource_array("spec/fixtures/one_org_issue_list.json") }
26
+ let(:two_issues) { sawyer_resource_array("spec/fixtures/two_org_issue_list.json") }
27
+ let(:issue_comments_passed) { sawyer_resource_array("spec/fixtures/issue_comments_passed.json") }
28
+ let(:issue_comments_failed) { sawyer_resource_array("spec/fixtures/issue_comments_failed.json") }
29
+ let(:issue_comments_in_review) { sawyer_resource_array("spec/fixtures/issue_comments_in_review.json") }
30
+ let(:issue_comments_fixed) { sawyer_resource_array("spec/fixtures/issue_comments_fixed.json") }
31
+ let(:issue_comments_new) { sawyer_resource_array("spec/fixtures/issue_comments_new.json") }
32
+
33
+ it { routes_command("pr list").to(:list_org_pr) }
34
+
35
+ it "displays a list of pull requests" do
36
+ expect_any_instance_of(Octokit::Client).to receive(:org_issues).and_return(two_issues)
37
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_passed, issue_comments_failed)
38
+
39
+ send_command("pr list")
40
+
41
+ expect(replies.last).to include("Found a bug")
42
+ end
43
+
44
+ it "displays the status of the PR (pass/fail)" do
45
+ expect_any_instance_of(Octokit::Client).to receive(:org_issues).and_return(two_issues)
46
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_passed, issue_comments_failed)
47
+
48
+ send_command("pr list")
49
+
50
+ expect(replies.last).to include("waffles (elephant)(elephant)(elephant) Found a bug https://github.com/octocat/Hello-World/pull/1347")
51
+ expect(replies.last).to include("waffles (poop) Found a waffle https://github.com/octocat/Hello-World/pull/1347")
52
+ end
53
+
54
+ it "displays the status of the PR (in review/fixed)" do
55
+ expect_any_instance_of(Octokit::Client).to receive(:org_issues).and_return(two_issues)
56
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_in_review, issue_comments_fixed)
57
+
58
+ send_command("pr list")
59
+
60
+ expect(replies.last).to include("waffles (book) Found a bug https://github.com/octocat/Hello-World/pull/1347")
61
+ expect(replies.last).to include("waffles (wave) Found a waffle https://github.com/octocat/Hello-World/pull/1347")
62
+ end
63
+
64
+ it "displays the status of the PR (new)" do
65
+ expect_any_instance_of(Octokit::Client).to receive(:org_issues).and_return(one_issue)
66
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_new)
67
+
68
+ send_command("pr list")
69
+
70
+ expect(replies.last).to include("waffles (new) Found a bug https://github.com/octocat/Hello-World/pull/1347")
71
+ end
72
+ end
@@ -0,0 +1,50 @@
1
+ require 'json'
2
+
3
+ describe Lita::Handlers::GithubPrList, lita_handler: true do
4
+ before :each do
5
+ Lita.config.handlers.github_pr_list.github_organization = 'aaaaaabbbbbbcccccc'
6
+ Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
7
+ Lita.config.handlers.github_pr_list.web_hook = 'https://example.com/hook'
8
+ end
9
+
10
+ let(:agent) do
11
+ Sawyer::Agent.new "http://example.com/a/" do |conn|
12
+ conn.builder.handlers.delete(Faraday::Adapter::NetHttp)
13
+ conn.adapter :test, Faraday::Adapter::Test::Stubs.new
14
+ end
15
+ end
16
+
17
+ def sawyer_resource_array(file_path)
18
+ resources = []
19
+ JSON.parse(File.read(file_path)).each do |i|
20
+ resources << Sawyer::Resource.new(agent, i)
21
+ end
22
+
23
+ resources
24
+ end
25
+
26
+ let(:repos) { sawyer_resource_array("spec/fixtures/repository_list.json") }
27
+ let(:hooks) { sawyer_resource_array("spec/fixtures/repository_hooks.json") }
28
+
29
+ it { routes_command("pr add hooks").to(:add_pr_hooks) }
30
+ it { routes_command("pr remove hooks").to(:remove_pr_hooks) }
31
+
32
+ it "adds web hooks to an org's repos" do
33
+ expect_any_instance_of(Octokit::Client).to receive(:repositories).and_return(repos)
34
+ expect_any_instance_of(Octokit::Client).to receive(:create_hook).twice.and_return(nil)
35
+
36
+ send_command("pr add hooks")
37
+
38
+ expect(replies.last).to include("Adding webhooks to aaaaaabbbbbbcccccc, this may take awhile...")
39
+ end
40
+
41
+ it "removes web hooks from an org's repos" do
42
+ expect_any_instance_of(Octokit::Client).to receive(:repositories).and_return(repos)
43
+ expect_any_instance_of(Octokit::Client).to receive(:hooks).twice.and_return(hooks)
44
+ expect_any_instance_of(Octokit::Client).to receive(:remove_hook).twice.and_return(nil)
45
+
46
+ send_command("pr remove hooks")
47
+
48
+ expect(replies.last).to include("Removing github_pr_list webhooks from aaaaaabbbbbbcccccc, this may take awhile...")
49
+ end
50
+ end
@@ -0,0 +1,8 @@
1
+ require "simplecov"
2
+ SimpleCov.start do
3
+ add_filter "/spec/"
4
+ add_filter "/vendor/"
5
+ end
6
+
7
+ require "lita/github_pr_list"
8
+ require "lita/rspec"