danger-spelling 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,350 @@
1
+ {
2
+ "url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls/1",
3
+ "id": 882292041,
4
+ "node_id": "PR_kwDOHAGOqs40lrVJ",
5
+ "html_url": "https://github.com/HamstringAssassin/danger-spelling/pull/1",
6
+ "diff_url": "https://github.com/HamstringAssassin/danger-spelling/pull/1.diff",
7
+ "patch_url": "https://github.com/HamstringAssassin/danger-spelling/pull/1.patch",
8
+ "issue_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues/1",
9
+ "number": 1,
10
+ "state": "open",
11
+ "locked": false,
12
+ "title": "Aloconnor/danger spelling implementation",
13
+ "user": {
14
+ "login": "HamstringAssassin",
15
+ "id": 6310250,
16
+ "node_id": "MDQ6VXNlcjYzMTAyNTA=",
17
+ "avatar_url": "https://avatars.githubusercontent.com/u/6310250?v=4",
18
+ "gravatar_id": "",
19
+ "url": "https://api.github.com/users/HamstringAssassin",
20
+ "html_url": "https://github.com/HamstringAssassin",
21
+ "followers_url": "https://api.github.com/users/HamstringAssassin/followers",
22
+ "following_url": "https://api.github.com/users/HamstringAssassin/following{/other_user}",
23
+ "gists_url": "https://api.github.com/users/HamstringAssassin/gists{/gist_id}",
24
+ "starred_url": "https://api.github.com/users/HamstringAssassin/starred{/owner}{/repo}",
25
+ "subscriptions_url": "https://api.github.com/users/HamstringAssassin/subscriptions",
26
+ "organizations_url": "https://api.github.com/users/HamstringAssassin/orgs",
27
+ "repos_url": "https://api.github.com/users/HamstringAssassin/repos",
28
+ "events_url": "https://api.github.com/users/HamstringAssassin/events{/privacy}",
29
+ "received_events_url": "https://api.github.com/users/HamstringAssassin/received_events",
30
+ "type": "User",
31
+ "site_admin": false
32
+ },
33
+ "body": null,
34
+ "created_at": "2022-03-17T10:12:44Z",
35
+ "updated_at": "2022-03-17T10:23:02Z",
36
+ "closed_at": null,
37
+ "merged_at": null,
38
+ "merge_commit_sha": "bff41f427e20cc7958cad5d2d6b349f6ed0c6433",
39
+ "assignee": null,
40
+ "assignees": [
41
+
42
+ ],
43
+ "requested_reviewers": [
44
+
45
+ ],
46
+ "requested_teams": [
47
+
48
+ ],
49
+ "labels": [
50
+
51
+ ],
52
+ "milestone": null,
53
+ "draft": false,
54
+ "commits_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls/1/commits",
55
+ "review_comments_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls/1/comments",
56
+ "review_comment_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls/comments{/number}",
57
+ "comments_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues/1/comments",
58
+ "statuses_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/statuses/a5ddd7207b711697261843ac1c283c42725b8669",
59
+ "head": {
60
+ "label": "HamstringAssassin:aloconnor/Danger-Spelling-Implementation",
61
+ "ref": "aloconnor/Danger-Spelling-Implementation",
62
+ "sha": "a5ddd7207b711697261843ac1c283c42725b8669",
63
+ "user": {
64
+ "login": "HamstringAssassin",
65
+ "id": 6310250,
66
+ "node_id": "MDQ6VXNlcjYzMTAyNTA=",
67
+ "avatar_url": "https://avatars.githubusercontent.com/u/6310250?v=4",
68
+ "gravatar_id": "",
69
+ "url": "https://api.github.com/users/HamstringAssassin",
70
+ "html_url": "https://github.com/HamstringAssassin",
71
+ "followers_url": "https://api.github.com/users/HamstringAssassin/followers",
72
+ "following_url": "https://api.github.com/users/HamstringAssassin/following{/other_user}",
73
+ "gists_url": "https://api.github.com/users/HamstringAssassin/gists{/gist_id}",
74
+ "starred_url": "https://api.github.com/users/HamstringAssassin/starred{/owner}{/repo}",
75
+ "subscriptions_url": "https://api.github.com/users/HamstringAssassin/subscriptions",
76
+ "organizations_url": "https://api.github.com/users/HamstringAssassin/orgs",
77
+ "repos_url": "https://api.github.com/users/HamstringAssassin/repos",
78
+ "events_url": "https://api.github.com/users/HamstringAssassin/events{/privacy}",
79
+ "received_events_url": "https://api.github.com/users/HamstringAssassin/received_events",
80
+ "type": "User",
81
+ "site_admin": false
82
+ },
83
+ "repo": {
84
+ "id": 469864106,
85
+ "node_id": "R_kgDOHAGOqg",
86
+ "name": "danger-spelling",
87
+ "full_name": "HamstringAssassin/danger-spelling",
88
+ "private": false,
89
+ "owner": {
90
+ "login": "HamstringAssassin",
91
+ "id": 6310250,
92
+ "node_id": "MDQ6VXNlcjYzMTAyNTA=",
93
+ "avatar_url": "https://avatars.githubusercontent.com/u/6310250?v=4",
94
+ "gravatar_id": "",
95
+ "url": "https://api.github.com/users/HamstringAssassin",
96
+ "html_url": "https://github.com/HamstringAssassin",
97
+ "followers_url": "https://api.github.com/users/HamstringAssassin/followers",
98
+ "following_url": "https://api.github.com/users/HamstringAssassin/following{/other_user}",
99
+ "gists_url": "https://api.github.com/users/HamstringAssassin/gists{/gist_id}",
100
+ "starred_url": "https://api.github.com/users/HamstringAssassin/starred{/owner}{/repo}",
101
+ "subscriptions_url": "https://api.github.com/users/HamstringAssassin/subscriptions",
102
+ "organizations_url": "https://api.github.com/users/HamstringAssassin/orgs",
103
+ "repos_url": "https://api.github.com/users/HamstringAssassin/repos",
104
+ "events_url": "https://api.github.com/users/HamstringAssassin/events{/privacy}",
105
+ "received_events_url": "https://api.github.com/users/HamstringAssassin/received_events",
106
+ "type": "User",
107
+ "site_admin": false
108
+ },
109
+ "html_url": "https://github.com/HamstringAssassin/danger-spelling",
110
+ "description": "Danger plugin for pyspelling",
111
+ "fork": false,
112
+ "url": "https://api.github.com/repos/HamstringAssassin/danger-spelling",
113
+ "forks_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/forks",
114
+ "keys_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/keys{/key_id}",
115
+ "collaborators_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/collaborators{/collaborator}",
116
+ "teams_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/teams",
117
+ "hooks_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/hooks",
118
+ "issue_events_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues/events{/number}",
119
+ "events_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/events",
120
+ "assignees_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/assignees{/user}",
121
+ "branches_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/branches{/branch}",
122
+ "tags_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/tags",
123
+ "blobs_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/blobs{/sha}",
124
+ "git_tags_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/tags{/sha}",
125
+ "git_refs_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/refs{/sha}",
126
+ "trees_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/trees{/sha}",
127
+ "statuses_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/statuses/{sha}",
128
+ "languages_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/languages",
129
+ "stargazers_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/stargazers",
130
+ "contributors_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/contributors",
131
+ "subscribers_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/subscribers",
132
+ "subscription_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/subscription",
133
+ "commits_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/commits{/sha}",
134
+ "git_commits_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/commits{/sha}",
135
+ "comments_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/comments{/number}",
136
+ "issue_comment_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues/comments{/number}",
137
+ "contents_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/contents/{+path}",
138
+ "compare_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/compare/{base}...{head}",
139
+ "merges_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/merges",
140
+ "archive_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/{archive_format}{/ref}",
141
+ "downloads_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/downloads",
142
+ "issues_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues{/number}",
143
+ "pulls_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls{/number}",
144
+ "milestones_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/milestones{/number}",
145
+ "notifications_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/notifications{?since,all,participating}",
146
+ "labels_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/labels{/name}",
147
+ "releases_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/releases{/id}",
148
+ "deployments_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/deployments",
149
+ "created_at": "2022-03-14T18:47:33Z",
150
+ "updated_at": "2022-03-14T18:47:33Z",
151
+ "pushed_at": "2022-03-17T10:23:02Z",
152
+ "git_url": "git://github.com/HamstringAssassin/danger-spelling.git",
153
+ "ssh_url": "git@github.com:HamstringAssassin/danger-spelling.git",
154
+ "clone_url": "https://github.com/HamstringAssassin/danger-spelling.git",
155
+ "svn_url": "https://github.com/HamstringAssassin/danger-spelling",
156
+ "homepage": null,
157
+ "size": 21,
158
+ "stargazers_count": 0,
159
+ "watchers_count": 0,
160
+ "language": null,
161
+ "has_issues": true,
162
+ "has_projects": true,
163
+ "has_downloads": true,
164
+ "has_wiki": true,
165
+ "has_pages": false,
166
+ "forks_count": 0,
167
+ "mirror_url": null,
168
+ "archived": false,
169
+ "disabled": false,
170
+ "open_issues_count": 1,
171
+ "license": null,
172
+ "allow_forking": true,
173
+ "is_template": false,
174
+ "topics": [
175
+
176
+ ],
177
+ "visibility": "public",
178
+ "forks": 0,
179
+ "open_issues": 1,
180
+ "watchers": 0,
181
+ "default_branch": "main"
182
+ }
183
+ },
184
+ "base": {
185
+ "label": "HamstringAssassin:main",
186
+ "ref": "main",
187
+ "sha": "bb784867a8657eb0539e02e168514dcbdb4bdb3b",
188
+ "user": {
189
+ "login": "HamstringAssassin",
190
+ "id": 6310250,
191
+ "node_id": "MDQ6VXNlcjYzMTAyNTA=",
192
+ "avatar_url": "https://avatars.githubusercontent.com/u/6310250?v=4",
193
+ "gravatar_id": "",
194
+ "url": "https://api.github.com/users/HamstringAssassin",
195
+ "html_url": "https://github.com/HamstringAssassin",
196
+ "followers_url": "https://api.github.com/users/HamstringAssassin/followers",
197
+ "following_url": "https://api.github.com/users/HamstringAssassin/following{/other_user}",
198
+ "gists_url": "https://api.github.com/users/HamstringAssassin/gists{/gist_id}",
199
+ "starred_url": "https://api.github.com/users/HamstringAssassin/starred{/owner}{/repo}",
200
+ "subscriptions_url": "https://api.github.com/users/HamstringAssassin/subscriptions",
201
+ "organizations_url": "https://api.github.com/users/HamstringAssassin/orgs",
202
+ "repos_url": "https://api.github.com/users/HamstringAssassin/repos",
203
+ "events_url": "https://api.github.com/users/HamstringAssassin/events{/privacy}",
204
+ "received_events_url": "https://api.github.com/users/HamstringAssassin/received_events",
205
+ "type": "User",
206
+ "site_admin": false
207
+ },
208
+ "repo": {
209
+ "id": 469864106,
210
+ "node_id": "R_kgDOHAGOqg",
211
+ "name": "danger-spelling",
212
+ "full_name": "HamstringAssassin/danger-spelling",
213
+ "private": false,
214
+ "owner": {
215
+ "login": "HamstringAssassin",
216
+ "id": 6310250,
217
+ "node_id": "MDQ6VXNlcjYzMTAyNTA=",
218
+ "avatar_url": "https://avatars.githubusercontent.com/u/6310250?v=4",
219
+ "gravatar_id": "",
220
+ "url": "https://api.github.com/users/HamstringAssassin",
221
+ "html_url": "https://github.com/HamstringAssassin",
222
+ "followers_url": "https://api.github.com/users/HamstringAssassin/followers",
223
+ "following_url": "https://api.github.com/users/HamstringAssassin/following{/other_user}",
224
+ "gists_url": "https://api.github.com/users/HamstringAssassin/gists{/gist_id}",
225
+ "starred_url": "https://api.github.com/users/HamstringAssassin/starred{/owner}{/repo}",
226
+ "subscriptions_url": "https://api.github.com/users/HamstringAssassin/subscriptions",
227
+ "organizations_url": "https://api.github.com/users/HamstringAssassin/orgs",
228
+ "repos_url": "https://api.github.com/users/HamstringAssassin/repos",
229
+ "events_url": "https://api.github.com/users/HamstringAssassin/events{/privacy}",
230
+ "received_events_url": "https://api.github.com/users/HamstringAssassin/received_events",
231
+ "type": "User",
232
+ "site_admin": false
233
+ },
234
+ "html_url": "https://github.com/HamstringAssassin/danger-spelling",
235
+ "description": "Danger plugin for pyspelling",
236
+ "fork": false,
237
+ "url": "https://api.github.com/repos/HamstringAssassin/danger-spelling",
238
+ "forks_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/forks",
239
+ "keys_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/keys{/key_id}",
240
+ "collaborators_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/collaborators{/collaborator}",
241
+ "teams_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/teams",
242
+ "hooks_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/hooks",
243
+ "issue_events_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues/events{/number}",
244
+ "events_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/events",
245
+ "assignees_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/assignees{/user}",
246
+ "branches_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/branches{/branch}",
247
+ "tags_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/tags",
248
+ "blobs_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/blobs{/sha}",
249
+ "git_tags_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/tags{/sha}",
250
+ "git_refs_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/refs{/sha}",
251
+ "trees_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/trees{/sha}",
252
+ "statuses_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/statuses/{sha}",
253
+ "languages_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/languages",
254
+ "stargazers_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/stargazers",
255
+ "contributors_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/contributors",
256
+ "subscribers_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/subscribers",
257
+ "subscription_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/subscription",
258
+ "commits_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/commits{/sha}",
259
+ "git_commits_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/git/commits{/sha}",
260
+ "comments_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/comments{/number}",
261
+ "issue_comment_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues/comments{/number}",
262
+ "contents_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/contents/{+path}",
263
+ "compare_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/compare/{base}...{head}",
264
+ "merges_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/merges",
265
+ "archive_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/{archive_format}{/ref}",
266
+ "downloads_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/downloads",
267
+ "issues_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues{/number}",
268
+ "pulls_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls{/number}",
269
+ "milestones_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/milestones{/number}",
270
+ "notifications_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/notifications{?since,all,participating}",
271
+ "labels_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/labels{/name}",
272
+ "releases_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/releases{/id}",
273
+ "deployments_url": "https://api.github.com/repos/HamstringAssassin/danger-spelling/deployments",
274
+ "created_at": "2022-03-14T18:47:33Z",
275
+ "updated_at": "2022-03-14T18:47:33Z",
276
+ "pushed_at": "2022-03-17T10:23:02Z",
277
+ "git_url": "git://github.com/HamstringAssassin/danger-spelling.git",
278
+ "ssh_url": "git@github.com:HamstringAssassin/danger-spelling.git",
279
+ "clone_url": "https://github.com/HamstringAssassin/danger-spelling.git",
280
+ "svn_url": "https://github.com/HamstringAssassin/danger-spelling",
281
+ "homepage": null,
282
+ "size": 21,
283
+ "stargazers_count": 0,
284
+ "watchers_count": 0,
285
+ "language": null,
286
+ "has_issues": true,
287
+ "has_projects": true,
288
+ "has_downloads": true,
289
+ "has_wiki": true,
290
+ "has_pages": false,
291
+ "forks_count": 0,
292
+ "mirror_url": null,
293
+ "archived": false,
294
+ "disabled": false,
295
+ "open_issues_count": 1,
296
+ "license": null,
297
+ "allow_forking": true,
298
+ "is_template": false,
299
+ "topics": [
300
+
301
+ ],
302
+ "visibility": "public",
303
+ "forks": 0,
304
+ "open_issues": 1,
305
+ "watchers": 0,
306
+ "default_branch": "main"
307
+ }
308
+ },
309
+ "_links": {
310
+ "self": {
311
+ "href": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls/1"
312
+ },
313
+ "html": {
314
+ "href": "https://github.com/HamstringAssassin/danger-spelling/pull/1"
315
+ },
316
+ "issue": {
317
+ "href": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues/1"
318
+ },
319
+ "comments": {
320
+ "href": "https://api.github.com/repos/HamstringAssassin/danger-spelling/issues/1/comments"
321
+ },
322
+ "review_comments": {
323
+ "href": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls/1/comments"
324
+ },
325
+ "review_comment": {
326
+ "href": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls/comments{/number}"
327
+ },
328
+ "commits": {
329
+ "href": "https://api.github.com/repos/HamstringAssassin/danger-spelling/pulls/1/commits"
330
+ },
331
+ "statuses": {
332
+ "href": "https://api.github.com/repos/HamstringAssassin/danger-spelling/statuses/a5ddd7207b711697261843ac1c283c42725b8669"
333
+ }
334
+ },
335
+ "author_association": "OWNER",
336
+ "auto_merge": null,
337
+ "active_lock_reason": null,
338
+ "merged": false,
339
+ "mergeable": true,
340
+ "rebaseable": true,
341
+ "mergeable_state": "clean",
342
+ "merged_by": null,
343
+ "comments": 0,
344
+ "review_comments": 0,
345
+ "maintainer_can_modify": false,
346
+ "commits": 5,
347
+ "additions": 624,
348
+ "deletions": 1,
349
+ "changed_files": 14
350
+ }
@@ -0,0 +1,7 @@
1
+ {"spec/fixtures/test.yml"=>"Misspelled words:\n
2
+ <text> spec/fixtures/test.yml\n
3
+ --------------------------------------------------------------------------------\n
4
+ APIs\n
5
+ Acitons\n
6
+ --------------------------------------------------------------------------------\n\n
7
+ !!!Spelling check failed!!!\n"}
@@ -0,0 +1,2 @@
1
+ write some APIs
2
+ perform some Acitons
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ ROOT = Pathname.new(File.expand_path("..", __dir__))
5
+ $:.unshift("#{ROOT}lib".to_s)
6
+ $:.unshift("#{ROOT}spec".to_s)
7
+
8
+ require "bundler/setup"
9
+ require "pry"
10
+
11
+ require "rspec"
12
+ require "danger"
13
+
14
+ if `git remote -v` == ""
15
+ puts "You cannot run tests without setting a local git remote on this repo"
16
+ puts "It's a weird side-effect of Danger's internals."
17
+ exit(0)
18
+ end
19
+
20
+ # Use coloured output, it's the best.
21
+ RSpec.configure do |config|
22
+ config.filter_gems_from_backtrace "bundler"
23
+ config.color = true
24
+ config.tty = true
25
+ end
26
+
27
+ require "danger_plugin"
28
+
29
+ # These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
30
+ # If you are expanding these files, see if it's already been done ^.
31
+
32
+ # A silent version of the user interface,
33
+ # it comes with an extra function `.string` which will
34
+ # strip all ANSI colours from the string.
35
+
36
+ # rubocop:disable Lint/NestedMethodDefinition
37
+ def testing_ui
38
+ @output = StringIO.new
39
+ def @output.winsize
40
+ [20, 9999]
41
+ end
42
+
43
+ cork = Cork::Board.new(out: @output)
44
+ def cork.string
45
+ out.string.gsub(/\e\[([;\d]+)?m/, "")
46
+ end
47
+ cork
48
+ end
49
+ # rubocop:enable Lint/NestedMethodDefinition
50
+
51
+ # Example environment (ENV) that would come from
52
+ # running a PR on TravisCI
53
+ def testing_env
54
+ {
55
+ "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
56
+ "TRAVIS_PULL_REQUEST" => "800",
57
+ "TRAVIS_REPO_SLUG" => "artsy/eigen",
58
+ "TRAVIS_COMMIT_RANGE" => "759adcbd0d8f...13c4dc8bb61d",
59
+ "DANGER_GITHUB_API_TOKEN" => "123sbdq54erfsd3422gdfio"
60
+ }
61
+ end
62
+
63
+ # A stubbed out Dangerfile for use in tests
64
+ def testing_dangerfile
65
+ env = Danger::EnvironmentManager.new(testing_env)
66
+ Danger::Dangerfile.new(env, testing_ui)
67
+ end
@@ -0,0 +1,189 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('spec_helper', __dir__)
4
+
5
+ module Danger
6
+ describe Danger::DangerSpelling do
7
+ it 'should be a plugin' do
8
+ expect(Danger::DangerSpelling.new(nil)).to be_a Danger::Plugin
9
+ end
10
+
11
+ describe 'with Dangerfile' do
12
+ before do
13
+ @dangerfile = testing_dangerfile
14
+ @spelling = @dangerfile.spelling
15
+
16
+ # mock the PR data
17
+ # you can then use this, eg. github.pr_author, later in the spec
18
+ # json = File.read("#{File.dirname(__FILE__)}/support/fixtures/github_pr.json")
19
+ # example json: `curl https://api.github.com/repos/danger/danger-plugin-template/pulls/18 > github_pr.json`
20
+ # https://api.github.com/repos/HamstringAssassin/resume/pull/2
21
+ # allow(@my_plugin.github).to receive(:pr_json).and_return(json)
22
+ end
23
+
24
+ describe 'pre-install checks and dependencies' do
25
+ # it 'handles not having pyspelling set' do
26
+ # allow(@spelling).to receive(:`).with('which pyspelling').and_return('')
27
+ # expect(@spelling.pyspelling_installed?).to be_falsy
28
+ # end
29
+
30
+ # it 'handles name not being set' do
31
+ # expect(@spelling.name).to eq('')
32
+ # end
33
+
34
+ it 'handles name being set' do
35
+ @spelling.name = 'test_name'
36
+ expect(@spelling.name).to eq('test_name')
37
+ end
38
+
39
+ it 'handles pyspelling not being installed' do
40
+ allow(@spelling).to receive(:pyspelling_installed?).and_return(false)
41
+ expect { @spelling.check_for_dependancies }.to raise_error('pyspelling is not in the users PATH, or it failed to install.')
42
+ end
43
+
44
+ it 'handles pyspelling being installed' do
45
+ allow(@spelling).to receive(:aspell_hunspell_installed?).and_return(false)
46
+ expect { @spelling.check_for_dependancies }.to raise_error('aspell or hunspell must be installed in order for pyspelling to work.')
47
+ end
48
+
49
+ it 'handles name being an empty string' do
50
+ @spelling.name = ""
51
+ expect { @spelling.check_spelling }.to raise_error('name must be a valid matrix name in your .pyspelling.yml.')
52
+ end
53
+
54
+ it 'handles name being nil' do
55
+ @spelling.name = nil
56
+ expect { @spelling.check_spelling }.to raise_error('name must be a valid matrix name in your .pyspelling.yml.')
57
+ end
58
+ end
59
+
60
+ describe 'pyspelling results ignore certain lines' do
61
+ before do
62
+ @dangerfile = testing_dangerfile
63
+ @spelling = @dangerfile.spelling
64
+ end
65
+
66
+ it "should ignore 'Misspelled words:' from results" do
67
+ initial = 'Misspelled words: '
68
+ file_path = 'test'
69
+ expect(@spelling.ignore_line(initial, file_path)).to eq(true)
70
+ end
71
+
72
+ it "should remove '!!!Spelling check failed!!!' from results" do
73
+ initial = '!!!Spelling check failed!!! '
74
+ file_path = 'test'
75
+ expect(@spelling.ignore_line(initial, file_path)).to eq(true)
76
+ end
77
+
78
+ it "should remove '--------------------------------------------------------------------------------' from results" do
79
+ initial = '-------------------------------------------------------------------------------- '
80
+ file_path = 'test'
81
+ expect(@spelling.ignore_line(initial, file_path)).to eq(true)
82
+ end
83
+
84
+ it 'should remove a given file_path from results' do
85
+ initial = ' <text> test '
86
+ file_path = 'test'
87
+ expect(@spelling.ignore_line(initial, file_path)).to eq(true)
88
+ end
89
+ end
90
+
91
+ describe 'pyspelling results have certain words removed' do
92
+ before do
93
+ @dangerfile = testing_dangerfile
94
+ @spelling = @dangerfile.spelling
95
+ end
96
+
97
+ it "should remove 'Misspelled words:' from results" do
98
+ initial = ['string', 'Misspelled words:', 'string']
99
+ expected = %w[string string]
100
+ file_path = 'test'
101
+ @spelling.ignored_words = []
102
+ expect(@spelling.remove_ignored_words(initial, file_path)).to eq(expected)
103
+ end
104
+
105
+ it 'should remove the file path from results' do
106
+ initial = ['string', '<text> test', 'string']
107
+ expected = %w[string string]
108
+ file_path = 'test'
109
+ @spelling.ignored_words = []
110
+ expect(@spelling.remove_ignored_words(initial, file_path)).to eq(expected)
111
+ end
112
+
113
+ it "should remove '!!!Spelling check failed!!!' from results" do
114
+ initial = ['string', '!!!Spelling check failed!!!', 'string']
115
+ expected = %w[string string]
116
+ file_path = 'test'
117
+ @spelling.ignored_words = []
118
+ expect(@spelling.remove_ignored_words(initial, file_path)).to eq(expected)
119
+ end
120
+
121
+ it 'it should remove any user defined words from results' do
122
+ initial = %w[string hammyassassin string]
123
+ expected = %w[string string]
124
+ file_path = 'test'
125
+ @spelling.ignored_words = ['hammyassassin']
126
+ expect(@spelling.remove_ignored_words(initial, file_path)).to eq(expected)
127
+ end
128
+ end
129
+
130
+ describe 'when spelling errors are found' do
131
+ before do
132
+ @dangerfile = testing_dangerfile
133
+ @spelling = @dangerfile.spelling
134
+ @spell_issues = eval(File.read("#{File.dirname(__FILE__)}/fixtures/spell_issues.txt"))
135
+
136
+ @json = File.read("#{File.dirname(__FILE__)}/fixtures/github_pr.json")
137
+ allow(@spelling.github).to receive(:pr_json).and_return(@json)
138
+ end
139
+
140
+ it 'should generate the correct message for the github' do
141
+ @spelling.ignored_words = []
142
+ expected = ["### Spell Checker found issues\n\n#### [spec/fixtures/test.yml](/HamstringAssassin/resume/"\
143
+ "tree//spec/fixtures/test.yml)\n\nLine | Typo |\n | --- | ------ |\n 1 | APIs \n 2 | Acitons \n "]
144
+ expect(@spelling.update_message_for_issues(@spell_issues, 'HamstringAssassin/resume')).to eq(expected)
145
+ end
146
+ end
147
+
148
+ describe 'when detecting a word in a given sentence' do
149
+ it 'should ignore a spelling mistake if its part of a full word' do
150
+ expect(@spelling.find_word_in_text('email is al@test.io', 'io')).to be_falsy
151
+ end
152
+
153
+ it 'should detect a word when its on its own and not part of another word' do
154
+ expect(@spelling.find_word_in_text('email is al@test.io io', 'io')).to be_truthy
155
+ end
156
+
157
+ it 'should detect a word even at the end of a sentence' do
158
+ expect(@spelling.find_word_in_text('email is al@test.io io.', 'io')).to be_truthy
159
+ end
160
+ end
161
+
162
+ describe 'when checking for URLs' do
163
+ it 'should detect a URL' do
164
+ expect(@spelling.url?('https://www.google.com')).to be_truthy
165
+ end
166
+
167
+ it 'should detect a URL' do
168
+ expect(@spelling.url?('https://google.com')).to be_truthy
169
+ end
170
+
171
+ it 'should detect a URL' do
172
+ expect(@spelling.url?('http://google.com')).to be_truthy
173
+ end
174
+
175
+ it 'should detect a URL' do
176
+ expect(@spelling.url?('https://google.com/test')).to be_truthy
177
+ end
178
+
179
+ it 'should detect a URL' do
180
+ expect(@spelling.url?('https://google.com/test?test=2')).to be_truthy
181
+ end
182
+
183
+ it 'should not detect a URL' do
184
+ expect(@spelling.url?('test@test.com')).to be_falsy
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end