GitHub PullRequestReviewCommentEvent at 2014-10-27 20:27:00
Repository: todomvc-api
Actor: stephenplusplus
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/tastejs/todomvc-api/pulls/comments/19434626","id":19434626,"diff_hunk":"@@ -48,19 +47,57 @@ hooks.before('Todos > Todo > Delete a Todo', function (t, done) {\n });\n \n hooks.after('Todos > Todo > Delete a Todo', function (t, done) {\n-\trequest.get({\n-\t\turi: uri(t, t.fullPath)\n-\t}, function (err, res, body) {\n+\trequest.get(uri(t.fullPath), function (err, res) {\n \t\tconsole.assert(res.statusCode === 404);\n \t\treturn done();\n \t});\n });\n \n-function uri(t, path) {\n-\treturn url.format({\n-\t\tprotocol: 'http',\n-\t\thostname: t.host,\n-\t\tport: t.port,\n-\t\tpathname: path\n+// Remove all todos that were created by the tests.\n+hooks.afterAll(function (done) {\n+\trequest.get(uri('/todos'), function (err, res, todos) {\n+\t\tvar deleted = 0;\n+\t\tvar doneCalled = false;\n+\n+\t\tfunction completeHook(err) {\n+\t\t\tif (!doneCalled) {\n+\t\t\t\tdoneCalled = true;\n+\t\t\t\tdone(err);\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (!Array.isArray(todos)) {\n+\t\t\ttry {\n+\t\t\t\ttodos = JSON.parse(todos);\n+\t\t\t} catch (e) {\n+\t\t\t\tcompleteHook(e);\n+\t\t\t}\n+\t\t}\n+\n+\t\tvar todosToDelete = todos.filter(function (todo) {\n+\t\t\treturn todo.title === 'dredd';\n+\t\t});\n+\n+\t\tif (todosToDelete.length === 0) {\n+\t\t\tcompleteHook();\n+\t\t\treturn;\n+\t\t}\n+\n+\t\ttodosToDelete.forEach(function (todo, index, todos) {\n+\t\t\trequest.del(uri('/todos/' + todo.id), function (err) {\n+\t\t\t\tif (err) {\n+\t\t\t\t\tcompleteHook(err);\n+\t\t\t\t\treturn;\n+\t\t\t\t}\n+\n+\t\t\t\tif (++deleted === todos.length) {\n+\t\t\t\t\tcompleteHook();","path":"hooks.js","position":null,"original_position":99,"commit_id":"2a8af4349c176ad6d672e70096100437dfd94e04","original_commit_id":"0a72823de02c2295dad2f2329698b825ec464ce7","user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=2","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"body":"asyncified. https://github.com/tastejs/todomvc-api/commit/2a8af4349c176ad6d672e70096100437dfd94e04","created_at":"2014-10-27T20:27:00Z","updated_at":"2014-10-27T20:27:00Z","html_url":"https://github.com/tastejs/todomvc-api/pull/2#discussion_r19434626","pull_request_url":"https://api.github.com/repos/tastejs/todomvc-api/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/tastejs/todomvc-api/pulls/comments/19434626"},"html":{"href":"https://github.com/tastejs/todomvc-api/pull/2#discussion_r19434626"},"pull_request":{"href":"https://api.github.com/repos/tastejs/todomvc-api/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/tastejs/todomvc-api/pulls/2","id":23322606,"html_url":"https://github.com/tastejs/todomvc-api/pull/2","diff_url":"https://github.com/tastejs/todomvc-api/pull/2.diff","patch_url":"https://github.com/tastejs/todomvc-api/pull/2.patch","issue_url":"https://api.github.com/repos/tastejs/todomvc-api/issues/2","number":2,"state":"open","locked":false,"title":"fix spaces vs tabs issue with dredd / delete todos after running tests","user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=2","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"body":"Tabs were breaking the apib file (my bad!), so I switched it back to our original format.\r\n\r\nIn a new afterAll hook, I'm getting all todos and deleting the ones we created -- the differentiator is the title: \"dredd\".\r\n\r\n@proppy is there a better way to do any of these changes?","created_at":"2014-10-24T20:30:01Z","updated_at":"2014-10-27T20:27:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c90414165f475d0e1fccc2943cddb6e2b419ac86","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tastejs/todomvc-api/pulls/2/commits","review_comments_url":"https://api.github.com/repos/tastejs/todomvc-api/pulls/2/comments","review_comment_url":"https://api.github.com/repos/tastejs/todomvc-api/pulls/comments/{number}","comments_url":"https://api.github.com/repos/tastejs/todomvc-api/issues/2/comments","statuses_url":"https://api.github.com/repos/tastejs/todomvc-api/statuses/2a8af4349c176ad6d672e70096100437dfd94e04","head":{"label":"tastejs:020","ref":"020","sha":"2a8af4349c176ad6d672e70096100437dfd94e04","user":{"login":"tastejs","id":1733746,"avatar_url":"https://avatars.githubusercontent.com/u/1733746?v=2","gravatar_id":"","url":"https://api.github.com/users/tastejs","html_url":"https://github.com/tastejs","followers_url":"https://api.github.com/users/tastejs/followers","following_url":"https://api.github.com/users/tastejs/following{/other_user}","gists_url":"https://api.github.com/users/tastejs/gists{/gist_id}","starred_url":"https://api.github.com/users/tastejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tastejs/subscriptions","organizations_url":"https://api.github.com/users/tastejs/orgs","repos_url":"https://api.github.com/users/tastejs/repos","events_url":"https://api.github.com/users/tastejs/events{/privacy}","received_events_url":"https://api.github.com/users/tastejs/received_events","type":"Organization","site_admin":false},"repo":{"id":25349669,"name":"todomvc-api","full_name":"tastejs/todomvc-api","owner":{"login":"tastejs","id":1733746,"avatar_url":"https://avatars.githubusercontent.com/u/1733746?v=2","gravatar_id":"","url":"https://api.github.com/users/tastejs","html_url":"https://github.com/tastejs","followers_url":"https://api.github.com/users/tastejs/followers","following_url":"https://api.github.com/users/tastejs/following{/other_user}","gists_url":"https://api.github.com/users/tastejs/gists{/gist_id}","starred_url":"https://api.github.com/users/tastejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tastejs/subscriptions","organizations_url":"https://api.github.com/users/tastejs/orgs","repos_url":"https://api.github.com/users/tastejs/repos","events_url":"https://api.github.com/users/tastejs/events{/privacy}","received_events_url":"https://api.github.com/users/tastejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tastejs/todomvc-api","description":"(POC) Validate your TodoMVC backend.","fork":false,"url":"https://api.github.com/repos/tastejs/todomvc-api","forks_url":"https://api.github.com/repos/tastejs/todomvc-api/forks","keys_url":"https://api.github.com/repos/tastejs/todomvc-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tastejs/todomvc-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tastejs/todomvc-api/teams","hooks_url":"https://api.github.com/repos/tastejs/todomvc-api/hooks","issue_events_url":"https://api.github.com/repos/tastejs/todomvc-api/issues/events{/number}","events_url":"https://api.github.com/repos/tastejs/todomvc-api/events","assignees_url":"https://api.github.com/repos/tastejs/todomvc-api/assignees{/user}","branches_url":"https://api.github.com/repos/tastejs/todomvc-api/branches{/branch}","tags_url":"https://api.github.com/repos/tastejs/todomvc-api/tags","blobs_url":"https://api.github.com/repos/tastejs/todomvc-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tastejs/todomvc-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tastejs/todomvc-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/tastejs/todomvc-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tastejs/todomvc-api/statuses/{sha}","languages_url":"https://api.github.com/repos/tastejs/todomvc-api/languages","stargazers_url":"https://api.github.com/repos/tastejs/todomvc-api/stargazers","contributors_url":"https://api.github.com/repos/tastejs/todomvc-api/contributors","subscribers_url":"https://api.github.com/repos/tastejs/todomvc-api/subscribers","subscription_url":"https://api.github.com/repos/tastejs/todomvc-api/subscription","commits_url":"https://api.github.com/repos/tastejs/todomvc-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/tastejs/todomvc-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/tastejs/todomvc-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/tastejs/todomvc-api/issues/comments/{number}","contents_url":"https://api.github.com/repos/tastejs/todomvc-api/contents/{+path}","compare_url":"https://api.github.com/repos/tastejs/todomvc-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tastejs/todomvc-api/merges","archive_url":"https://api.github.com/repos/tastejs/todomvc-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tastejs/todomvc-api/downloads","issues_url":"https://api.github.com/repos/tastejs/todomvc-api/issues{/number}","pulls_url":"https://api.github.com/repos/tastejs/todomvc-api/pulls{/number}","milestones_url":"https://api.github.com/repos/tastejs/todomvc-api/milestones{/number}","notifications_url":"https://api.github.com/repos/tastejs/todomvc-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tastejs/todomvc-api/labels{/name}","releases_url":"https://api.github.com/repos/tastejs/todomvc-api/releases{/id}","created_at":"2014-10-17T09:17:36Z","updated_at":"2014-10-25T23:56:23Z","pushed_at":"2014-10-27T20:26:45Z","git_url":"git://github.com/tastejs/todomvc-api.git","ssh_url":"git@github.com:tastejs/todomvc-api.git","clone_url":"https://github.com/tastejs/todomvc-api.git","svn_url":"https://github.com/tastejs/todomvc-api","homepage":"","size":164,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":5,"default_branch":"master"}},"base":{"label":"tastejs:master","ref":"master","sha":"c20723fd2843a0b579016e39db9ff32062c121ae","user":{"login":"tastejs","id":1733746,"avatar_url":"https://avatars.githubusercontent.com/u/1733746?v=2","gravatar_id":"","url":"https://api.github.com/users/tastejs","html_url":"https://github.com/tastejs","followers_url":"https://api.github.com/users/tastejs/followers","following_url":"https://api.github.com/users/tastejs/following{/other_user}","gists_url":"https://api.github.com/users/tastejs/gists{/gist_id}","starred_url":"https://api.github.com/users/tastejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tastejs/subscriptions","organizations_url":"https://api.github.com/users/tastejs/orgs","repos_url":"https://api.github.com/users/tastejs/repos","events_url":"https://api.github.com/users/tastejs/events{/privacy}","received_events_url":"https://api.github.com/users/tastejs/received_events","type":"Organization","site_admin":false},"repo":{"id":25349669,"name":"todomvc-api","full_name":"tastejs/todomvc-api","owner":{"login":"tastejs","id":1733746,"avatar_url":"https://avatars.githubusercontent.com/u/1733746?v=2","gravatar_id":"","url":"https://api.github.com/users/tastejs","html_url":"https://github.com/tastejs","followers_url":"https://api.github.com/users/tastejs/followers","following_url":"https://api.github.com/users/tastejs/following{/other_user}","gists_url":"https://api.github.com/users/tastejs/gists{/gist_id}","starred_url":"https://api.github.com/users/tastejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tastejs/subscriptions","organizations_url":"https://api.github.com/users/tastejs/orgs","repos_url":"https://api.github.com/users/tastejs/repos","events_url":"https://api.github.com/users/tastejs/events{/privacy}","received_events_url":"https://api.github.com/users/tastejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tastejs/todomvc-api","description":"(POC) Validate your TodoMVC backend.","fork":false,"url":"https://api.github.com/repos/tastejs/todomvc-api","forks_url":"https://api.github.com/repos/tastejs/todomvc-api/forks","keys_url":"https://api.github.com/repos/tastejs/todomvc-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tastejs/todomvc-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tastejs/todomvc-api/teams","hooks_url":"https://api.github.com/repos/tastejs/todomvc-api/hooks","issue_events_url":"https://api.github.com/repos/tastejs/todomvc-api/issues/events{/number}","events_url":"https://api.github.com/repos/tastejs/todomvc-api/events","assignees_url":"https://api.github.com/repos/tastejs/todomvc-api/assignees{/user}","branches_url":"https://api.github.com/repos/tastejs/todomvc-api/branches{/branch}","tags_url":"https://api.github.com/repos/tastejs/todomvc-api/tags","blobs_url":"https://api.github.com/repos/tastejs/todomvc-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tastejs/todomvc-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tastejs/todomvc-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/tastejs/todomvc-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tastejs/todomvc-api/statuses/{sha}","languages_url":"https://api.github.com/repos/tastejs/todomvc-api/languages","stargazers_url":"https://api.github.com/repos/tastejs/todomvc-api/stargazers","contributors_url":"https://api.github.com/repos/tastejs/todomvc-api/contributors","subscribers_url":"https://api.github.com/repos/tastejs/todomvc-api/subscribers","subscription_url":"https://api.github.com/repos/tastejs/todomvc-api/subscription","commits_url":"https://api.github.com/repos/tastejs/todomvc-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/tastejs/todomvc-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/tastejs/todomvc-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/tastejs/todomvc-api/issues/comments/{number}","contents_url":"https://api.github.com/repos/tastejs/todomvc-api/contents/{+path}","compare_url":"https://api.github.com/repos/tastejs/todomvc-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tastejs/todomvc-api/merges","archive_url":"https://api.github.com/repos/tastejs/todomvc-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tastejs/todomvc-api/downloads","issues_url":"https://api.github.com/repos/tastejs/todomvc-api/issues{/number}","pulls_url":"https://api.github.com/repos/tastejs/todomvc-api/pulls{/number}","milestones_url":"https://api.github.com/repos/tastejs/todomvc-api/milestones{/number}","notifications_url":"https://api.github.com/repos/tastejs/todomvc-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tastejs/todomvc-api/labels{/name}","releases_url":"https://api.github.com/repos/tastejs/todomvc-api/releases{/id}","created_at":"2014-10-17T09:17:36Z","updated_at":"2014-10-25T23:56:23Z","pushed_at":"2014-10-27T20:26:45Z","git_url":"git://github.com/tastejs/todomvc-api.git","ssh_url":"git@github.com:tastejs/todomvc-api.git","clone_url":"https://github.com/tastejs/todomvc-api.git","svn_url":"https://github.com/tastejs/todomvc-api","homepage":"","size":164,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tastejs/todomvc-api/pulls/2"},"html":{"href":"https://github.com/tastejs/todomvc-api/pull/2"},"issue":{"href":"https://api.github.com/repos/tastejs/todomvc-api/issues/2"},"comments":{"href":"https://api.github.com/repos/tastejs/todomvc-api/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/tastejs/todomvc-api/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/tastejs/todomvc-api/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/tastejs/todomvc-api/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/tastejs/todomvc-api/statuses/2a8af4349c176ad6d672e70096100437dfd94e04"}}}}