danger-pivotal_tracker 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,366 @@
1
+ {
2
+ "url": "https://api.github.com/repos/danger/danger-plugin-template/pulls/18",
3
+ "id": 185317229,
4
+ "node_id": "MDExOlB1bGxSZXF1ZXN0MTg1MzE3MjI5",
5
+ "html_url": "https://github.com/danger/danger-plugin-template/pull/18",
6
+ "diff_url": "https://github.com/danger/danger-plugin-template/pull/18.diff",
7
+ "patch_url": "https://github.com/danger/danger-plugin-template/pull/18.patch",
8
+ "issue_url": "https://api.github.com/repos/danger/danger-plugin-template/issues/18",
9
+ "number": 18,
10
+ "state": "closed",
11
+ "locked": false,
12
+ "title": "[Delivered #1234321] some great feature",
13
+ "user": {
14
+ "login": "wilrnh",
15
+ "id": 555966,
16
+ "node_id": "MDQ6VXNlcjU1NTk2Ng==",
17
+ "avatar_url": "https://avatars2.githubusercontent.com/u/555966?v=4",
18
+ "gravatar_id": "",
19
+ "url": "https://api.github.com/users/wilrnh",
20
+ "html_url": "https://github.com/wilrnh",
21
+ "followers_url": "https://api.github.com/users/wilrnh/followers",
22
+ "following_url": "https://api.github.com/users/wilrnh/following{/other_user}",
23
+ "gists_url": "https://api.github.com/users/wilrnh/gists{/gist_id}",
24
+ "starred_url": "https://api.github.com/users/wilrnh/starred{/owner}{/repo}",
25
+ "subscriptions_url": "https://api.github.com/users/wilrnh/subscriptions",
26
+ "organizations_url": "https://api.github.com/users/wilrnh/orgs",
27
+ "repos_url": "https://api.github.com/users/wilrnh/repos",
28
+ "events_url": "https://api.github.com/users/wilrnh/events{/privacy}",
29
+ "received_events_url": "https://api.github.com/users/wilrnh/received_events",
30
+ "type": "User",
31
+ "site_admin": false
32
+ },
33
+ "body": "Fixes danger/danger#661\r\n\r\nadd example how to mock PRs",
34
+ "created_at": "2018-05-02T01:52:26Z",
35
+ "updated_at": "2018-05-02T10:37:04Z",
36
+ "closed_at": "2018-05-02T10:37:04Z",
37
+ "merged_at": "2018-05-02T10:37:04Z",
38
+ "merge_commit_sha": "39eacac22d52a2b70fc49bd8aba19eb7d2864717",
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
+ "commits_url": "https://api.github.com/repos/danger/danger-plugin-template/pulls/18/commits",
54
+ "review_comments_url": "https://api.github.com/repos/danger/danger-plugin-template/pulls/18/comments",
55
+ "review_comment_url": "https://api.github.com/repos/danger/danger-plugin-template/pulls/comments{/number}",
56
+ "comments_url": "https://api.github.com/repos/danger/danger-plugin-template/issues/18/comments",
57
+ "statuses_url": "https://api.github.com/repos/danger/danger-plugin-template/statuses/abe89bee0cdc5f45b1dee62c60e74c70f3fcb5d5",
58
+ "head": {
59
+ "label": "wilrnh:661-mocking-prs",
60
+ "ref": "661-mocking-prs",
61
+ "sha": "abe89bee0cdc5f45b1dee62c60e74c70f3fcb5d5",
62
+ "user": {
63
+ "login": "wilrnh",
64
+ "id": 555966,
65
+ "node_id": "MDQ6VXNlcjU1NTk2Ng==",
66
+ "avatar_url": "https://avatars2.githubusercontent.com/u/555966?v=4",
67
+ "gravatar_id": "",
68
+ "url": "https://api.github.com/users/wilrnh",
69
+ "html_url": "https://github.com/wilrnh",
70
+ "followers_url": "https://api.github.com/users/wilrnh/followers",
71
+ "following_url": "https://api.github.com/users/wilrnh/following{/other_user}",
72
+ "gists_url": "https://api.github.com/users/wilrnh/gists{/gist_id}",
73
+ "starred_url": "https://api.github.com/users/wilrnh/starred{/owner}{/repo}",
74
+ "subscriptions_url": "https://api.github.com/users/wilrnh/subscriptions",
75
+ "organizations_url": "https://api.github.com/users/wilrnh/orgs",
76
+ "repos_url": "https://api.github.com/users/wilrnh/repos",
77
+ "events_url": "https://api.github.com/users/wilrnh/events{/privacy}",
78
+ "received_events_url": "https://api.github.com/users/wilrnh/received_events",
79
+ "type": "User",
80
+ "site_admin": false
81
+ },
82
+ "repo": {
83
+ "id": 131783880,
84
+ "node_id": "MDEwOlJlcG9zaXRvcnkxMzE3ODM4ODA=",
85
+ "name": "danger-plugin-template",
86
+ "full_name": "wilrnh/danger-plugin-template",
87
+ "private": false,
88
+ "owner": {
89
+ "login": "wilrnh",
90
+ "id": 555966,
91
+ "node_id": "MDQ6VXNlcjU1NTk2Ng==",
92
+ "avatar_url": "https://avatars2.githubusercontent.com/u/555966?v=4",
93
+ "gravatar_id": "",
94
+ "url": "https://api.github.com/users/wilrnh",
95
+ "html_url": "https://github.com/wilrnh",
96
+ "followers_url": "https://api.github.com/users/wilrnh/followers",
97
+ "following_url": "https://api.github.com/users/wilrnh/following{/other_user}",
98
+ "gists_url": "https://api.github.com/users/wilrnh/gists{/gist_id}",
99
+ "starred_url": "https://api.github.com/users/wilrnh/starred{/owner}{/repo}",
100
+ "subscriptions_url": "https://api.github.com/users/wilrnh/subscriptions",
101
+ "organizations_url": "https://api.github.com/users/wilrnh/orgs",
102
+ "repos_url": "https://api.github.com/users/wilrnh/repos",
103
+ "events_url": "https://api.github.com/users/wilrnh/events{/privacy}",
104
+ "received_events_url": "https://api.github.com/users/wilrnh/received_events",
105
+ "type": "User",
106
+ "site_admin": false
107
+ },
108
+ "html_url": "https://github.com/wilrnh/danger-plugin-template",
109
+ "description": "An opinionated template for creating a Danger plugin",
110
+ "fork": true,
111
+ "url": "https://api.github.com/repos/wilrnh/danger-plugin-template",
112
+ "forks_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/forks",
113
+ "keys_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/keys{/key_id}",
114
+ "collaborators_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/collaborators{/collaborator}",
115
+ "teams_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/teams",
116
+ "hooks_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/hooks",
117
+ "issue_events_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/issues/events{/number}",
118
+ "events_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/events",
119
+ "assignees_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/assignees{/user}",
120
+ "branches_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/branches{/branch}",
121
+ "tags_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/tags",
122
+ "blobs_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/git/blobs{/sha}",
123
+ "git_tags_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/git/tags{/sha}",
124
+ "git_refs_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/git/refs{/sha}",
125
+ "trees_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/git/trees{/sha}",
126
+ "statuses_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/statuses/{sha}",
127
+ "languages_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/languages",
128
+ "stargazers_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/stargazers",
129
+ "contributors_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/contributors",
130
+ "subscribers_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/subscribers",
131
+ "subscription_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/subscription",
132
+ "commits_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/commits{/sha}",
133
+ "git_commits_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/git/commits{/sha}",
134
+ "comments_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/comments{/number}",
135
+ "issue_comment_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/issues/comments{/number}",
136
+ "contents_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/contents/{+path}",
137
+ "compare_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/compare/{base}...{head}",
138
+ "merges_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/merges",
139
+ "archive_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/{archive_format}{/ref}",
140
+ "downloads_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/downloads",
141
+ "issues_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/issues{/number}",
142
+ "pulls_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/pulls{/number}",
143
+ "milestones_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/milestones{/number}",
144
+ "notifications_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/notifications{?since,all,participating}",
145
+ "labels_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/labels{/name}",
146
+ "releases_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/releases{/id}",
147
+ "deployments_url": "https://api.github.com/repos/wilrnh/danger-plugin-template/deployments",
148
+ "created_at": "2018-05-02T01:50:31Z",
149
+ "updated_at": "2018-05-02T01:50:32Z",
150
+ "pushed_at": "2018-05-02T02:04:13Z",
151
+ "git_url": "git://github.com/wilrnh/danger-plugin-template.git",
152
+ "ssh_url": "git@github.com:wilrnh/danger-plugin-template.git",
153
+ "clone_url": "https://github.com/wilrnh/danger-plugin-template.git",
154
+ "svn_url": "https://github.com/wilrnh/danger-plugin-template",
155
+ "homepage": null,
156
+ "size": 32,
157
+ "stargazers_count": 0,
158
+ "watchers_count": 0,
159
+ "language": "Ruby",
160
+ "has_issues": false,
161
+ "has_projects": true,
162
+ "has_downloads": true,
163
+ "has_wiki": true,
164
+ "has_pages": false,
165
+ "forks_count": 0,
166
+ "mirror_url": null,
167
+ "archived": false,
168
+ "disabled": false,
169
+ "open_issues_count": 0,
170
+ "license": {
171
+ "key": "other",
172
+ "name": "Other",
173
+ "spdx_id": "NOASSERTION",
174
+ "url": null,
175
+ "node_id": "MDc6TGljZW5zZTA="
176
+ },
177
+ "forks": 0,
178
+ "open_issues": 0,
179
+ "watchers": 0,
180
+ "default_branch": "master"
181
+ }
182
+ },
183
+ "base": {
184
+ "label": "danger:master",
185
+ "ref": "master",
186
+ "sha": "30bd69c1c09d927abde0695fcb39dd70d4cc0f81",
187
+ "user": {
188
+ "login": "danger",
189
+ "id": 17147106,
190
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjE3MTQ3MTA2",
191
+ "avatar_url": "https://avatars3.githubusercontent.com/u/17147106?v=4",
192
+ "gravatar_id": "",
193
+ "url": "https://api.github.com/users/danger",
194
+ "html_url": "https://github.com/danger",
195
+ "followers_url": "https://api.github.com/users/danger/followers",
196
+ "following_url": "https://api.github.com/users/danger/following{/other_user}",
197
+ "gists_url": "https://api.github.com/users/danger/gists{/gist_id}",
198
+ "starred_url": "https://api.github.com/users/danger/starred{/owner}{/repo}",
199
+ "subscriptions_url": "https://api.github.com/users/danger/subscriptions",
200
+ "organizations_url": "https://api.github.com/users/danger/orgs",
201
+ "repos_url": "https://api.github.com/users/danger/repos",
202
+ "events_url": "https://api.github.com/users/danger/events{/privacy}",
203
+ "received_events_url": "https://api.github.com/users/danger/received_events",
204
+ "type": "Organization",
205
+ "site_admin": false
206
+ },
207
+ "repo": {
208
+ "id": 60424063,
209
+ "node_id": "MDEwOlJlcG9zaXRvcnk2MDQyNDA2Mw==",
210
+ "name": "danger-plugin-template",
211
+ "full_name": "danger/danger-plugin-template",
212
+ "private": false,
213
+ "owner": {
214
+ "login": "danger",
215
+ "id": 17147106,
216
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjE3MTQ3MTA2",
217
+ "avatar_url": "https://avatars3.githubusercontent.com/u/17147106?v=4",
218
+ "gravatar_id": "",
219
+ "url": "https://api.github.com/users/danger",
220
+ "html_url": "https://github.com/danger",
221
+ "followers_url": "https://api.github.com/users/danger/followers",
222
+ "following_url": "https://api.github.com/users/danger/following{/other_user}",
223
+ "gists_url": "https://api.github.com/users/danger/gists{/gist_id}",
224
+ "starred_url": "https://api.github.com/users/danger/starred{/owner}{/repo}",
225
+ "subscriptions_url": "https://api.github.com/users/danger/subscriptions",
226
+ "organizations_url": "https://api.github.com/users/danger/orgs",
227
+ "repos_url": "https://api.github.com/users/danger/repos",
228
+ "events_url": "https://api.github.com/users/danger/events{/privacy}",
229
+ "received_events_url": "https://api.github.com/users/danger/received_events",
230
+ "type": "Organization",
231
+ "site_admin": false
232
+ },
233
+ "html_url": "https://github.com/danger/danger-plugin-template",
234
+ "description": "An opinionated template for creating a Danger plugin",
235
+ "fork": false,
236
+ "url": "https://api.github.com/repos/danger/danger-plugin-template",
237
+ "forks_url": "https://api.github.com/repos/danger/danger-plugin-template/forks",
238
+ "keys_url": "https://api.github.com/repos/danger/danger-plugin-template/keys{/key_id}",
239
+ "collaborators_url": "https://api.github.com/repos/danger/danger-plugin-template/collaborators{/collaborator}",
240
+ "teams_url": "https://api.github.com/repos/danger/danger-plugin-template/teams",
241
+ "hooks_url": "https://api.github.com/repos/danger/danger-plugin-template/hooks",
242
+ "issue_events_url": "https://api.github.com/repos/danger/danger-plugin-template/issues/events{/number}",
243
+ "events_url": "https://api.github.com/repos/danger/danger-plugin-template/events",
244
+ "assignees_url": "https://api.github.com/repos/danger/danger-plugin-template/assignees{/user}",
245
+ "branches_url": "https://api.github.com/repos/danger/danger-plugin-template/branches{/branch}",
246
+ "tags_url": "https://api.github.com/repos/danger/danger-plugin-template/tags",
247
+ "blobs_url": "https://api.github.com/repos/danger/danger-plugin-template/git/blobs{/sha}",
248
+ "git_tags_url": "https://api.github.com/repos/danger/danger-plugin-template/git/tags{/sha}",
249
+ "git_refs_url": "https://api.github.com/repos/danger/danger-plugin-template/git/refs{/sha}",
250
+ "trees_url": "https://api.github.com/repos/danger/danger-plugin-template/git/trees{/sha}",
251
+ "statuses_url": "https://api.github.com/repos/danger/danger-plugin-template/statuses/{sha}",
252
+ "languages_url": "https://api.github.com/repos/danger/danger-plugin-template/languages",
253
+ "stargazers_url": "https://api.github.com/repos/danger/danger-plugin-template/stargazers",
254
+ "contributors_url": "https://api.github.com/repos/danger/danger-plugin-template/contributors",
255
+ "subscribers_url": "https://api.github.com/repos/danger/danger-plugin-template/subscribers",
256
+ "subscription_url": "https://api.github.com/repos/danger/danger-plugin-template/subscription",
257
+ "commits_url": "https://api.github.com/repos/danger/danger-plugin-template/commits{/sha}",
258
+ "git_commits_url": "https://api.github.com/repos/danger/danger-plugin-template/git/commits{/sha}",
259
+ "comments_url": "https://api.github.com/repos/danger/danger-plugin-template/comments{/number}",
260
+ "issue_comment_url": "https://api.github.com/repos/danger/danger-plugin-template/issues/comments{/number}",
261
+ "contents_url": "https://api.github.com/repos/danger/danger-plugin-template/contents/{+path}",
262
+ "compare_url": "https://api.github.com/repos/danger/danger-plugin-template/compare/{base}...{head}",
263
+ "merges_url": "https://api.github.com/repos/danger/danger-plugin-template/merges",
264
+ "archive_url": "https://api.github.com/repos/danger/danger-plugin-template/{archive_format}{/ref}",
265
+ "downloads_url": "https://api.github.com/repos/danger/danger-plugin-template/downloads",
266
+ "issues_url": "https://api.github.com/repos/danger/danger-plugin-template/issues{/number}",
267
+ "pulls_url": "https://api.github.com/repos/danger/danger-plugin-template/pulls{/number}",
268
+ "milestones_url": "https://api.github.com/repos/danger/danger-plugin-template/milestones{/number}",
269
+ "notifications_url": "https://api.github.com/repos/danger/danger-plugin-template/notifications{?since,all,participating}",
270
+ "labels_url": "https://api.github.com/repos/danger/danger-plugin-template/labels{/name}",
271
+ "releases_url": "https://api.github.com/repos/danger/danger-plugin-template/releases{/id}",
272
+ "deployments_url": "https://api.github.com/repos/danger/danger-plugin-template/deployments",
273
+ "created_at": "2016-06-04T18:17:02Z",
274
+ "updated_at": "2019-04-25T06:12:09Z",
275
+ "pushed_at": "2019-03-30T16:08:01Z",
276
+ "git_url": "git://github.com/danger/danger-plugin-template.git",
277
+ "ssh_url": "git@github.com:danger/danger-plugin-template.git",
278
+ "clone_url": "https://github.com/danger/danger-plugin-template.git",
279
+ "svn_url": "https://github.com/danger/danger-plugin-template",
280
+ "homepage": null,
281
+ "size": 35,
282
+ "stargazers_count": 13,
283
+ "watchers_count": 13,
284
+ "language": "Ruby",
285
+ "has_issues": true,
286
+ "has_projects": true,
287
+ "has_downloads": true,
288
+ "has_wiki": true,
289
+ "has_pages": false,
290
+ "forks_count": 10,
291
+ "mirror_url": null,
292
+ "archived": false,
293
+ "disabled": false,
294
+ "open_issues_count": 2,
295
+ "license": {
296
+ "key": "other",
297
+ "name": "Other",
298
+ "spdx_id": "NOASSERTION",
299
+ "url": null,
300
+ "node_id": "MDc6TGljZW5zZTA="
301
+ },
302
+ "forks": 10,
303
+ "open_issues": 2,
304
+ "watchers": 13,
305
+ "default_branch": "master"
306
+ }
307
+ },
308
+ "_links": {
309
+ "self": {
310
+ "href": "https://api.github.com/repos/danger/danger-plugin-template/pulls/18"
311
+ },
312
+ "html": {
313
+ "href": "https://github.com/danger/danger-plugin-template/pull/18"
314
+ },
315
+ "issue": {
316
+ "href": "https://api.github.com/repos/danger/danger-plugin-template/issues/18"
317
+ },
318
+ "comments": {
319
+ "href": "https://api.github.com/repos/danger/danger-plugin-template/issues/18/comments"
320
+ },
321
+ "review_comments": {
322
+ "href": "https://api.github.com/repos/danger/danger-plugin-template/pulls/18/comments"
323
+ },
324
+ "review_comment": {
325
+ "href": "https://api.github.com/repos/danger/danger-plugin-template/pulls/comments{/number}"
326
+ },
327
+ "commits": {
328
+ "href": "https://api.github.com/repos/danger/danger-plugin-template/pulls/18/commits"
329
+ },
330
+ "statuses": {
331
+ "href": "https://api.github.com/repos/danger/danger-plugin-template/statuses/abe89bee0cdc5f45b1dee62c60e74c70f3fcb5d5"
332
+ }
333
+ },
334
+ "author_association": "CONTRIBUTOR",
335
+ "merged": true,
336
+ "mergeable": null,
337
+ "rebaseable": null,
338
+ "mergeable_state": "unknown",
339
+ "merged_by": {
340
+ "login": "orta",
341
+ "id": 49038,
342
+ "node_id": "MDQ6VXNlcjQ5MDM4",
343
+ "avatar_url": "https://avatars2.githubusercontent.com/u/49038?v=4",
344
+ "gravatar_id": "",
345
+ "url": "https://api.github.com/users/orta",
346
+ "html_url": "https://github.com/orta",
347
+ "followers_url": "https://api.github.com/users/orta/followers",
348
+ "following_url": "https://api.github.com/users/orta/following{/other_user}",
349
+ "gists_url": "https://api.github.com/users/orta/gists{/gist_id}",
350
+ "starred_url": "https://api.github.com/users/orta/starred{/owner}{/repo}",
351
+ "subscriptions_url": "https://api.github.com/users/orta/subscriptions",
352
+ "organizations_url": "https://api.github.com/users/orta/orgs",
353
+ "repos_url": "https://api.github.com/users/orta/repos",
354
+ "events_url": "https://api.github.com/users/orta/events{/privacy}",
355
+ "received_events_url": "https://api.github.com/users/orta/received_events",
356
+ "type": "User",
357
+ "site_admin": false
358
+ },
359
+ "comments": 2,
360
+ "review_comments": 0,
361
+ "maintainer_can_modify": false,
362
+ "commits": 2,
363
+ "additions": 5,
364
+ "deletions": 0,
365
+ "changed_files": 1
366
+ }
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("spec_helper", __dir__)
4
+
5
+ # Run tests using ```bundle exec rake spec```
6
+
7
+ module Danger
8
+ describe Danger::DangerPivotalTracker do
9
+ it "should be a plugin" do
10
+ expect(Danger::DangerPivotalTracker.new(nil)).to be_a Danger::Plugin
11
+ end
12
+
13
+ #
14
+ # You should test your custom attributes and methods here
15
+ #
16
+ describe "with Dangerfile" do
17
+ before do
18
+ @dangerfile = testing_dangerfile
19
+ @my_plugin = @dangerfile.pivotal_tracker
20
+
21
+ allow(@my_plugin).to receive_message_chain("github.pr_title").and_return("[Delivered #167207295] [Finishes #333207295] #444444295 some great feature")
22
+ allow(@my_plugin).to receive_message_chain("github.pr_body").and_return("[Delivered #167207295]")
23
+ end
24
+
25
+ describe "Finding pivotal stories" do
26
+ context "when key is delivered" do
27
+ it "returns story id matched in the PR title" do
28
+ issues = @my_plugin.find_pivotal_stories(key: "Delivered")
29
+
30
+ expect(issues).to eq(["167207295"])
31
+ end
32
+
33
+ it "does not include the ID of a finished story" do
34
+ issues = @my_plugin.find_pivotal_stories(key: "Delivered")
35
+
36
+ expect(issues).not_to include(["333207295"])
37
+ end
38
+ end
39
+
40
+ context "when key is finishes" do
41
+ it "returns only IDs of stories preceeded by Finishes" do
42
+ issues = @my_plugin.find_pivotal_stories(key: "Finishes")
43
+
44
+ expect(issues).to eq(["333207295"])
45
+ end
46
+ end
47
+
48
+ context "when search commits is true" do
49
+ it "returns three ids" do
50
+ issues = @my_plugin.find_pivotal_stories(search_commits: true)
51
+
52
+ expect(issues).to eq(["167207295", "333207295", "444444295"])
53
+ end
54
+ end
55
+
56
+ context "when no valid story ids" do
57
+ it "returns only IDs of stories preceeded by Finishes" do
58
+ allow(@my_plugin).to receive_message_chain("github.pr_body").and_return("the details")
59
+ allow(@my_plugin).to receive_message_chain("github.pr_title").and_return("some great feature")
60
+
61
+ issues = @my_plugin.find_pivotal_stories
62
+
63
+ expect(issues).to eq([])
64
+ end
65
+ end
66
+
67
+ it "returns 3 story ids when no key is provided" do
68
+ issues = @my_plugin.find_pivotal_stories
69
+
70
+ expect(issues).to eq(["167207295", "333207295", "444444295"])
71
+ end
72
+ end
73
+
74
+ describe "Generating pivotal tracker story URLs" do
75
+ it "creates a pivotal tracker link appending the story id" do
76
+ issues = @my_plugin.check(key: "Delivered", project_id: "2371161")
77
+
78
+ expect(issues.first).to include("https://www.pivotaltracker.com/n/projects/2371161/stories/167207295")
79
+ end
80
+
81
+ it "creates a pivotal tracker link appending the story id when only project id provided" do
82
+ issues = @my_plugin.check(project_id: "2371161")
83
+
84
+ expect(issues.first).to include("https://www.pivotaltracker.com/n/projects/2371161/stories/167207295")
85
+ end
86
+
87
+ it "creates a pivotal tracker link appending the story id when no params set" do
88
+ issues = @my_plugin.check
89
+ expect(issues.first).to include("/stories/167207295")
90
+ end
91
+
92
+ context "when no valid story ids" do
93
+ it "returns only IDs of stories preceeded by Finishes" do
94
+ allow(@my_plugin).to receive_message_chain("github.pr_body").and_return("the details")
95
+ allow(@my_plugin).to receive_message_chain("github.pr_title").and_return("some great feature")
96
+
97
+ issues = @my_plugin.check
98
+
99
+ expect(issues).not_to include("https://www.pivotaltracker.com/")
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end