{"action":"created","comment":{"url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/comments/43300491","id":43300491,"diff_hunk":"@@ -8,7 +8,58 @@\n     end\n   end\n \n-  describe '.to_commit' do\n+  describe '#story_ids' do\n+    let(:story_id) { random_story_id }\n+\n+    subject { PullRequest.new(title: title).story_ids }\n+\n+    context 'no story ID' do\n+      let(:title) { Faker::Lorem.sentence }\n+\n+      it 'returns an empty array' do\n+        expect(subject).to be == []\n+      end\n+    end\n+\n+    context 'story ID without #' do\n+      let(:title) { \"[#{story_id}] Faker::Lorem.sentence\" }\n+\n+      it 'returns an empty array' do\n+        expect(subject).to be == []\n+      end\n+    end\n+\n+    context 'story ID at the beginning' do\n+      let(:title) { \"[##{story_id}] #{Faker::Lorem.sentence}\" }\n+\n+      it 'returns the story ID' do\n+        expect(subject).to be == [story_id.to_s]\n+      end\n+    end\n+\n+    context 'multiple story IDs' do\n+      let(:story_ids) { (1..3).collect { random_story_id} }\n+      let(:title) { \"#{ids_string} #{Faker::Lorem.sentence}\" }\n+\n+      context 'separate brackets' do\n+        let(:ids_string) { story_ids.collect {|id| \"[##{id}]\" }.join ' ' }\n+\n+        it 'returns all the story IDs' do\n+          expect(subject).to match_array story_ids.collect(&:to_s)\n+        end\n+      end\n+\n+      context 'same brackets' do\n+        let(:ids_string) { \"[#{story_ids.collect {|id| \"##{id}\" }.join ','}]\"}","path":"spec/unit/pull_request_spec.rb","position":47,"original_position":47,"commit_id":"6009db60f8e15449e14372a427985a7444a17fd3","original_commit_id":"6009db60f8e15449e14372a427985a7444a17fd3","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Prefer `map` over `collect`.<br>Space missing inside }.<br>Space between { and | missing.","created_at":"2015-10-28T18:46:18Z","updated_at":"2015-10-28T18:46:18Z","html_url":"https://github.com/marnen/pivotal-tracker-pr-hook/pull/2#discussion_r43300491","pull_request_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/comments/43300491"},"html":{"href":"https://github.com/marnen/pivotal-tracker-pr-hook/pull/2#discussion_r43300491"},"pull_request":{"href":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/2","id":49049811,"html_url":"https://github.com/marnen/pivotal-tracker-pr-hook/pull/2","diff_url":"https://github.com/marnen/pivotal-tracker-pr-hook/pull/2.diff","patch_url":"https://github.com/marnen/pivotal-tracker-pr-hook/pull/2.patch","issue_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues/2","number":2,"state":"open","locked":false,"title":"Rewrite for proper comment hook","user":{"login":"marnen","id":34378,"avatar_url":"https://avatars.githubusercontent.com/u/34378?v=3","gravatar_id":"","url":"https://api.github.com/users/marnen","html_url":"https://github.com/marnen","followers_url":"https://api.github.com/users/marnen/followers","following_url":"https://api.github.com/users/marnen/following{/other_user}","gists_url":"https://api.github.com/users/marnen/gists{/gist_id}","starred_url":"https://api.github.com/users/marnen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marnen/subscriptions","organizations_url":"https://api.github.com/users/marnen/orgs","repos_url":"https://api.github.com/users/marnen/repos","events_url":"https://api.github.com/users/marnen/events{/privacy}","received_events_url":"https://api.github.com/users/marnen/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-28T18:46:12Z","updated_at":"2015-10-28T18:46:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c4e93c8c12348e460dd77953e67884f4a6a86f2","assignee":{"login":"marnen","id":34378,"avatar_url":"https://avatars.githubusercontent.com/u/34378?v=3","gravatar_id":"","url":"https://api.github.com/users/marnen","html_url":"https://github.com/marnen","followers_url":"https://api.github.com/users/marnen/followers","following_url":"https://api.github.com/users/marnen/following{/other_user}","gists_url":"https://api.github.com/users/marnen/gists{/gist_id}","starred_url":"https://api.github.com/users/marnen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marnen/subscriptions","organizations_url":"https://api.github.com/users/marnen/orgs","repos_url":"https://api.github.com/users/marnen/repos","events_url":"https://api.github.com/users/marnen/events{/privacy}","received_events_url":"https://api.github.com/users/marnen/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/2/commits","review_comments_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/2/comments","review_comment_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues/2/comments","statuses_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/statuses/6009db60f8e15449e14372a427985a7444a17fd3","head":{"label":"marnen:rewrite-for-proper-comment-hook","ref":"rewrite-for-proper-comment-hook","sha":"6009db60f8e15449e14372a427985a7444a17fd3","user":{"login":"marnen","id":34378,"avatar_url":"https://avatars.githubusercontent.com/u/34378?v=3","gravatar_id":"","url":"https://api.github.com/users/marnen","html_url":"https://github.com/marnen","followers_url":"https://api.github.com/users/marnen/followers","following_url":"https://api.github.com/users/marnen/following{/other_user}","gists_url":"https://api.github.com/users/marnen/gists{/gist_id}","starred_url":"https://api.github.com/users/marnen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marnen/subscriptions","organizations_url":"https://api.github.com/users/marnen/orgs","repos_url":"https://api.github.com/users/marnen/repos","events_url":"https://api.github.com/users/marnen/events{/privacy}","received_events_url":"https://api.github.com/users/marnen/received_events","type":"User","site_admin":false},"repo":{"id":44996169,"name":"pivotal-tracker-pr-hook","full_name":"marnen/pivotal-tracker-pr-hook","owner":{"login":"marnen","id":34378,"avatar_url":"https://avatars.githubusercontent.com/u/34378?v=3","gravatar_id":"","url":"https://api.github.com/users/marnen","html_url":"https://github.com/marnen","followers_url":"https://api.github.com/users/marnen/followers","following_url":"https://api.github.com/users/marnen/following{/other_user}","gists_url":"https://api.github.com/users/marnen/gists{/gist_id}","starred_url":"https://api.github.com/users/marnen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marnen/subscriptions","organizations_url":"https://api.github.com/users/marnen/orgs","repos_url":"https://api.github.com/users/marnen/repos","events_url":"https://api.github.com/users/marnen/events{/privacy}","received_events_url":"https://api.github.com/users/marnen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marnen/pivotal-tracker-pr-hook","description":"Webhook to send GitHub pull requests to Pivotal Tracker","fork":false,"url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook","forks_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/forks","keys_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/teams","hooks_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/hooks","issue_events_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues/events{/number}","events_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/events","assignees_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/assignees{/user}","branches_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/branches{/branch}","tags_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/tags","blobs_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/refs{/sha}","trees_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/statuses/{sha}","languages_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/languages","stargazers_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/stargazers","contributors_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/contributors","subscribers_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/subscribers","subscription_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/subscription","commits_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/commits{/sha}","git_commits_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/commits{/sha}","comments_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/comments{/number}","issue_comment_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues/comments{/number}","contents_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/contents/{+path}","compare_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/merges","archive_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/downloads","issues_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues{/number}","pulls_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls{/number}","milestones_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/milestones{/number}","notifications_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/labels{/name}","releases_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/releases{/id}","created_at":"2015-10-26T20:44:58Z","updated_at":"2015-10-27T19:21:46Z","pushed_at":"2015-10-28T18:46:12Z","git_url":"git://github.com/marnen/pivotal-tracker-pr-hook.git","ssh_url":"git@github.com:marnen/pivotal-tracker-pr-hook.git","clone_url":"https://github.com/marnen/pivotal-tracker-pr-hook.git","svn_url":"https://github.com/marnen/pivotal-tracker-pr-hook","homepage":"","size":0,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"marnen:master","ref":"master","sha":"8940ced5ed1f3c656a959bfa6afb382535418775","user":{"login":"marnen","id":34378,"avatar_url":"https://avatars.githubusercontent.com/u/34378?v=3","gravatar_id":"","url":"https://api.github.com/users/marnen","html_url":"https://github.com/marnen","followers_url":"https://api.github.com/users/marnen/followers","following_url":"https://api.github.com/users/marnen/following{/other_user}","gists_url":"https://api.github.com/users/marnen/gists{/gist_id}","starred_url":"https://api.github.com/users/marnen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marnen/subscriptions","organizations_url":"https://api.github.com/users/marnen/orgs","repos_url":"https://api.github.com/users/marnen/repos","events_url":"https://api.github.com/users/marnen/events{/privacy}","received_events_url":"https://api.github.com/users/marnen/received_events","type":"User","site_admin":false},"repo":{"id":44996169,"name":"pivotal-tracker-pr-hook","full_name":"marnen/pivotal-tracker-pr-hook","owner":{"login":"marnen","id":34378,"avatar_url":"https://avatars.githubusercontent.com/u/34378?v=3","gravatar_id":"","url":"https://api.github.com/users/marnen","html_url":"https://github.com/marnen","followers_url":"https://api.github.com/users/marnen/followers","following_url":"https://api.github.com/users/marnen/following{/other_user}","gists_url":"https://api.github.com/users/marnen/gists{/gist_id}","starred_url":"https://api.github.com/users/marnen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marnen/subscriptions","organizations_url":"https://api.github.com/users/marnen/orgs","repos_url":"https://api.github.com/users/marnen/repos","events_url":"https://api.github.com/users/marnen/events{/privacy}","received_events_url":"https://api.github.com/users/marnen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marnen/pivotal-tracker-pr-hook","description":"Webhook to send GitHub pull requests to Pivotal Tracker","fork":false,"url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook","forks_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/forks","keys_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/teams","hooks_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/hooks","issue_events_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues/events{/number}","events_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/events","assignees_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/assignees{/user}","branches_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/branches{/branch}","tags_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/tags","blobs_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/refs{/sha}","trees_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/statuses/{sha}","languages_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/languages","stargazers_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/stargazers","contributors_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/contributors","subscribers_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/subscribers","subscription_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/subscription","commits_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/commits{/sha}","git_commits_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/git/commits{/sha}","comments_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/comments{/number}","issue_comment_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues/comments{/number}","contents_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/contents/{+path}","compare_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/merges","archive_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/downloads","issues_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues{/number}","pulls_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls{/number}","milestones_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/milestones{/number}","notifications_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/labels{/name}","releases_url":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/releases{/id}","created_at":"2015-10-26T20:44:58Z","updated_at":"2015-10-27T19:21:46Z","pushed_at":"2015-10-28T18:46:12Z","git_url":"git://github.com/marnen/pivotal-tracker-pr-hook.git","ssh_url":"git@github.com:marnen/pivotal-tracker-pr-hook.git","clone_url":"https://github.com/marnen/pivotal-tracker-pr-hook.git","svn_url":"https://github.com/marnen/pivotal-tracker-pr-hook","homepage":"","size":0,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/2"},"html":{"href":"https://github.com/marnen/pivotal-tracker-pr-hook/pull/2"},"issue":{"href":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues/2"},"comments":{"href":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/marnen/pivotal-tracker-pr-hook/statuses/6009db60f8e15449e14372a427985a7444a17fd3"}}}}