{"action":"created","comment":{"url":"https://api.github.com/repos/andela-nmartin/docms2/pulls/comments/46386100","id":46386100,"diff_hunk":"@@ -1 +1,116 @@\n-var request = require('superagent');\n\\ No newline at end of file\n+var url = 'http://localhost:3000',\n+  request = require('superagent'),\n+  user = {\n+    username: 'smalik',\n+    password: '12345'\n+  },\n+  authToken,\n+  userId,\n+  document = {\n+    title: 'Area of Triangle',\n+    content: 'This is obtained from the base and height. Get half of the base and multiply by the height to get the area.'\n+  };\n+\n+function login(done) {\n+  request\n+    .post(url + '/api/users/login')\n+    .send(user)\n+    .end(function(err, res) {\n+      if (!err) {\n+        console.log(\"You have successfully logged in.\");\n+        userId = res.body.id;\n+        authToken = res.body.token;\n+        done();\n+      } else {\n+        console.log(\"There was a problem logging you in.\\n\" + '\\n' + res.body.message);\n+        done();\n+      }\n+    });\n+}\n+\n+function logout(done) {\n+  request\n+    .get('http://localhost:3000/api/users/logout')\n+    .set('x-access-token', authToken)\n+    .end(function(err, res) {\n+      if (!err) {\n+        authToken = '';\n+        console.log(\"You have logged out of docms.\");\n+        done();\n+      } else {\n+        console.log(\"Error\" + res.body.message);\n+        done();\n+      }\n+    });\n+}\n+\n+describe('Document', function() {\n+  it('validates that one has to be authenticated to access documents (GET /api/documents)', function(done) {\n+    request\n+      .get(url + '/api/documents')\n+      .end(function(err, res) {\n+        expect(403, done);\n+        expect('Content-Type', 'json', done);\n+        expect(typeof res.body).toBe('object');\n+        expect(res.body.success).toEqual(false);\n+        expect({","path":"tests/documents.spec.js","position":58,"original_position":58,"commit_id":"83b8a4278244522ac0badf5594292250d7b34c93","original_commit_id":"83b8a4278244522ac0badf5594292250d7b34c93","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":"Mixed double and single quotes.","created_at":"2015-12-02T08:10:35Z","updated_at":"2015-12-02T08:10:35Z","html_url":"https://github.com/andela-nmartin/docms2/pull/2#discussion_r46386100","pull_request_url":"https://api.github.com/repos/andela-nmartin/docms2/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/andela-nmartin/docms2/pulls/comments/46386100"},"html":{"href":"https://github.com/andela-nmartin/docms2/pull/2#discussion_r46386100"},"pull_request":{"href":"https://api.github.com/repos/andela-nmartin/docms2/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/andela-nmartin/docms2/pulls/2","id":52364916,"html_url":"https://github.com/andela-nmartin/docms2/pull/2","diff_url":"https://github.com/andela-nmartin/docms2/pull/2.diff","patch_url":"https://github.com/andela-nmartin/docms2/pull/2.patch","issue_url":"https://api.github.com/repos/andela-nmartin/docms2/issues/2","number":2,"state":"open","locked":false,"title":"Merges 'models' into 'develop'","user":{"login":"andela-nmartin","id":12892047,"avatar_url":"https://avatars.githubusercontent.com/u/12892047?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-nmartin","html_url":"https://github.com/andela-nmartin","followers_url":"https://api.github.com/users/andela-nmartin/followers","following_url":"https://api.github.com/users/andela-nmartin/following{/other_user}","gists_url":"https://api.github.com/users/andela-nmartin/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-nmartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-nmartin/subscriptions","organizations_url":"https://api.github.com/users/andela-nmartin/orgs","repos_url":"https://api.github.com/users/andela-nmartin/repos","events_url":"https://api.github.com/users/andela-nmartin/events{/privacy}","received_events_url":"https://api.github.com/users/andela-nmartin/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-02T08:10:27Z","updated_at":"2015-12-02T08:10:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88d92b47fffb000fe3ba48285d612e0c543c6a98","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela-nmartin/docms2/pulls/2/commits","review_comments_url":"https://api.github.com/repos/andela-nmartin/docms2/pulls/2/comments","review_comment_url":"https://api.github.com/repos/andela-nmartin/docms2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela-nmartin/docms2/issues/2/comments","statuses_url":"https://api.github.com/repos/andela-nmartin/docms2/statuses/83b8a4278244522ac0badf5594292250d7b34c93","head":{"label":"andela-nmartin:models","ref":"models","sha":"83b8a4278244522ac0badf5594292250d7b34c93","user":{"login":"andela-nmartin","id":12892047,"avatar_url":"https://avatars.githubusercontent.com/u/12892047?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-nmartin","html_url":"https://github.com/andela-nmartin","followers_url":"https://api.github.com/users/andela-nmartin/followers","following_url":"https://api.github.com/users/andela-nmartin/following{/other_user}","gists_url":"https://api.github.com/users/andela-nmartin/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-nmartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-nmartin/subscriptions","organizations_url":"https://api.github.com/users/andela-nmartin/orgs","repos_url":"https://api.github.com/users/andela-nmartin/repos","events_url":"https://api.github.com/users/andela-nmartin/events{/privacy}","received_events_url":"https://api.github.com/users/andela-nmartin/received_events","type":"User","site_admin":false},"repo":{"id":46967491,"name":"docms2","full_name":"andela-nmartin/docms2","owner":{"login":"andela-nmartin","id":12892047,"avatar_url":"https://avatars.githubusercontent.com/u/12892047?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-nmartin","html_url":"https://github.com/andela-nmartin","followers_url":"https://api.github.com/users/andela-nmartin/followers","following_url":"https://api.github.com/users/andela-nmartin/following{/other_user}","gists_url":"https://api.github.com/users/andela-nmartin/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-nmartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-nmartin/subscriptions","organizations_url":"https://api.github.com/users/andela-nmartin/orgs","repos_url":"https://api.github.com/users/andela-nmartin/repos","events_url":"https://api.github.com/users/andela-nmartin/events{/privacy}","received_events_url":"https://api.github.com/users/andela-nmartin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-nmartin/docms2","description":"Document Management System (Node, Express, Mongo)","fork":false,"url":"https://api.github.com/repos/andela-nmartin/docms2","forks_url":"https://api.github.com/repos/andela-nmartin/docms2/forks","keys_url":"https://api.github.com/repos/andela-nmartin/docms2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-nmartin/docms2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-nmartin/docms2/teams","hooks_url":"https://api.github.com/repos/andela-nmartin/docms2/hooks","issue_events_url":"https://api.github.com/repos/andela-nmartin/docms2/issues/events{/number}","events_url":"https://api.github.com/repos/andela-nmartin/docms2/events","assignees_url":"https://api.github.com/repos/andela-nmartin/docms2/assignees{/user}","branches_url":"https://api.github.com/repos/andela-nmartin/docms2/branches{/branch}","tags_url":"https://api.github.com/repos/andela-nmartin/docms2/tags","blobs_url":"https://api.github.com/repos/andela-nmartin/docms2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-nmartin/docms2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-nmartin/docms2/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-nmartin/docms2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-nmartin/docms2/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-nmartin/docms2/languages","stargazers_url":"https://api.github.com/repos/andela-nmartin/docms2/stargazers","contributors_url":"https://api.github.com/repos/andela-nmartin/docms2/contributors","subscribers_url":"https://api.github.com/repos/andela-nmartin/docms2/subscribers","subscription_url":"https://api.github.com/repos/andela-nmartin/docms2/subscription","commits_url":"https://api.github.com/repos/andela-nmartin/docms2/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-nmartin/docms2/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-nmartin/docms2/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-nmartin/docms2/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-nmartin/docms2/contents/{+path}","compare_url":"https://api.github.com/repos/andela-nmartin/docms2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-nmartin/docms2/merges","archive_url":"https://api.github.com/repos/andela-nmartin/docms2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-nmartin/docms2/downloads","issues_url":"https://api.github.com/repos/andela-nmartin/docms2/issues{/number}","pulls_url":"https://api.github.com/repos/andela-nmartin/docms2/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-nmartin/docms2/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-nmartin/docms2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-nmartin/docms2/labels{/name}","releases_url":"https://api.github.com/repos/andela-nmartin/docms2/releases{/id}","created_at":"2015-11-27T08:05:52Z","updated_at":"2015-11-27T08:05:52Z","pushed_at":"2015-12-02T08:10:28Z","git_url":"git://github.com/andela-nmartin/docms2.git","ssh_url":"git@github.com:andela-nmartin/docms2.git","clone_url":"https://github.com/andela-nmartin/docms2.git","svn_url":"https://github.com/andela-nmartin/docms2","homepage":null,"size":20,"stargazers_count":0,"watchers_count":0,"language":null,"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":"andela-nmartin:develop","ref":"develop","sha":"dba5f5e32fdfc3ff5e8aaf453bc9580bd0e4ebf8","user":{"login":"andela-nmartin","id":12892047,"avatar_url":"https://avatars.githubusercontent.com/u/12892047?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-nmartin","html_url":"https://github.com/andela-nmartin","followers_url":"https://api.github.com/users/andela-nmartin/followers","following_url":"https://api.github.com/users/andela-nmartin/following{/other_user}","gists_url":"https://api.github.com/users/andela-nmartin/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-nmartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-nmartin/subscriptions","organizations_url":"https://api.github.com/users/andela-nmartin/orgs","repos_url":"https://api.github.com/users/andela-nmartin/repos","events_url":"https://api.github.com/users/andela-nmartin/events{/privacy}","received_events_url":"https://api.github.com/users/andela-nmartin/received_events","type":"User","site_admin":false},"repo":{"id":46967491,"name":"docms2","full_name":"andela-nmartin/docms2","owner":{"login":"andela-nmartin","id":12892047,"avatar_url":"https://avatars.githubusercontent.com/u/12892047?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-nmartin","html_url":"https://github.com/andela-nmartin","followers_url":"https://api.github.com/users/andela-nmartin/followers","following_url":"https://api.github.com/users/andela-nmartin/following{/other_user}","gists_url":"https://api.github.com/users/andela-nmartin/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-nmartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-nmartin/subscriptions","organizations_url":"https://api.github.com/users/andela-nmartin/orgs","repos_url":"https://api.github.com/users/andela-nmartin/repos","events_url":"https://api.github.com/users/andela-nmartin/events{/privacy}","received_events_url":"https://api.github.com/users/andela-nmartin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-nmartin/docms2","description":"Document Management System (Node, Express, Mongo)","fork":false,"url":"https://api.github.com/repos/andela-nmartin/docms2","forks_url":"https://api.github.com/repos/andela-nmartin/docms2/forks","keys_url":"https://api.github.com/repos/andela-nmartin/docms2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-nmartin/docms2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-nmartin/docms2/teams","hooks_url":"https://api.github.com/repos/andela-nmartin/docms2/hooks","issue_events_url":"https://api.github.com/repos/andela-nmartin/docms2/issues/events{/number}","events_url":"https://api.github.com/repos/andela-nmartin/docms2/events","assignees_url":"https://api.github.com/repos/andela-nmartin/docms2/assignees{/user}","branches_url":"https://api.github.com/repos/andela-nmartin/docms2/branches{/branch}","tags_url":"https://api.github.com/repos/andela-nmartin/docms2/tags","blobs_url":"https://api.github.com/repos/andela-nmartin/docms2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-nmartin/docms2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-nmartin/docms2/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-nmartin/docms2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-nmartin/docms2/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-nmartin/docms2/languages","stargazers_url":"https://api.github.com/repos/andela-nmartin/docms2/stargazers","contributors_url":"https://api.github.com/repos/andela-nmartin/docms2/contributors","subscribers_url":"https://api.github.com/repos/andela-nmartin/docms2/subscribers","subscription_url":"https://api.github.com/repos/andela-nmartin/docms2/subscription","commits_url":"https://api.github.com/repos/andela-nmartin/docms2/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-nmartin/docms2/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-nmartin/docms2/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-nmartin/docms2/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-nmartin/docms2/contents/{+path}","compare_url":"https://api.github.com/repos/andela-nmartin/docms2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-nmartin/docms2/merges","archive_url":"https://api.github.com/repos/andela-nmartin/docms2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-nmartin/docms2/downloads","issues_url":"https://api.github.com/repos/andela-nmartin/docms2/issues{/number}","pulls_url":"https://api.github.com/repos/andela-nmartin/docms2/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-nmartin/docms2/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-nmartin/docms2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-nmartin/docms2/labels{/name}","releases_url":"https://api.github.com/repos/andela-nmartin/docms2/releases{/id}","created_at":"2015-11-27T08:05:52Z","updated_at":"2015-11-27T08:05:52Z","pushed_at":"2015-12-02T08:10:28Z","git_url":"git://github.com/andela-nmartin/docms2.git","ssh_url":"git@github.com:andela-nmartin/docms2.git","clone_url":"https://github.com/andela-nmartin/docms2.git","svn_url":"https://github.com/andela-nmartin/docms2","homepage":null,"size":20,"stargazers_count":0,"watchers_count":0,"language":null,"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/andela-nmartin/docms2/pulls/2"},"html":{"href":"https://github.com/andela-nmartin/docms2/pull/2"},"issue":{"href":"https://api.github.com/repos/andela-nmartin/docms2/issues/2"},"comments":{"href":"https://api.github.com/repos/andela-nmartin/docms2/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/andela-nmartin/docms2/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/andela-nmartin/docms2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela-nmartin/docms2/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/andela-nmartin/docms2/statuses/83b8a4278244522ac0badf5594292250d7b34c93"}}}}