{"action":"created","comment":{"url":"https://api.github.com/repos/education/classroom/pulls/comments/40313893","id":40313893,"diff_hunk":"@@ -10,15 +10,38 @@\n     session[:user_id] = user.id\n   end\n \n-  describe 'GET #index' do\n-    it 'returns success status' do\n-      get :index\n-      expect(response).to have_http_status(:success)\n+  describe 'GET #index', :vcr do\n+    context 'unauthenticated user' do\n+      before do\n+        session[:user_id] = nil\n+      end\n+\n+      it 'will redirect you to the login_path' do\n+        get :index\n+        expect(response).to redirect_to(login_path)\n+      end\n+    end\n+\n+    context 'authenticated user with a valid token' do\n+      it 'will take you to the index page' do\n+        get :index\n+        expect(response).to have_http_status(:success)\n+      end\n+\n+      it 'sets the users organization' do\n+        get :index\n+        expect(assigns(:organizations)).not_to be_nil\n+      end\n     end\n \n-    it 'sets the users organization' do\n-      get :index\n-      expect(assigns(:organizations)).not_to be_nil\n+    context 'authenticated user with an invalid token' do\n+      it 'will take you to the login_path' do\n+        user.token = '12345'","path":"spec/controllers/organizations_controller_spec.rb","position":null,"original_position":37,"commit_id":"2929aa80def10d1de26ba14a482a4642834920b8","original_commit_id":"547907597525a726f7b61fad9c710df4a88c7d06","user":{"login":"tarebyte","id":564113,"avatar_url":"https://avatars.githubusercontent.com/u/564113?v=3","gravatar_id":"","url":"https://api.github.com/users/tarebyte","html_url":"https://github.com/tarebyte","followers_url":"https://api.github.com/users/tarebyte/followers","following_url":"https://api.github.com/users/tarebyte/following{/other_user}","gists_url":"https://api.github.com/users/tarebyte/gists{/gist_id}","starred_url":"https://api.github.com/users/tarebyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarebyte/subscriptions","organizations_url":"https://api.github.com/users/tarebyte/orgs","repos_url":"https://api.github.com/users/tarebyte/repos","events_url":"https://api.github.com/users/tarebyte/events{/privacy}","received_events_url":"https://api.github.com/users/tarebyte/received_events","type":"User","site_admin":false},"body":"I just made up a token I knew would be invalid","created_at":"2015-09-24T12:41:18Z","updated_at":"2015-09-24T12:41:18Z","html_url":"https://github.com/education/classroom/pull/256#discussion_r40313893","pull_request_url":"https://api.github.com/repos/education/classroom/pulls/256","_links":{"self":{"href":"https://api.github.com/repos/education/classroom/pulls/comments/40313893"},"html":{"href":"https://github.com/education/classroom/pull/256#discussion_r40313893"},"pull_request":{"href":"https://api.github.com/repos/education/classroom/pulls/256"}}},"pull_request":{"url":"https://api.github.com/repos/education/classroom/pulls/256","id":45775964,"html_url":"https://github.com/education/classroom/pull/256","diff_url":"https://github.com/education/classroom/pull/256.diff","patch_url":"https://github.com/education/classroom/pull/256.patch","issue_url":"https://api.github.com/repos/education/classroom/issues/256","number":256,"state":"open","locked":false,"title":"User application authorization","user":{"login":"tarebyte","id":564113,"avatar_url":"https://avatars.githubusercontent.com/u/564113?v=3","gravatar_id":"","url":"https://api.github.com/users/tarebyte","html_url":"https://github.com/tarebyte","followers_url":"https://api.github.com/users/tarebyte/followers","following_url":"https://api.github.com/users/tarebyte/following{/other_user}","gists_url":"https://api.github.com/users/tarebyte/gists{/gist_id}","starred_url":"https://api.github.com/users/tarebyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarebyte/subscriptions","organizations_url":"https://api.github.com/users/tarebyte/orgs","repos_url":"https://api.github.com/users/tarebyte/repos","events_url":"https://api.github.com/users/tarebyte/events{/privacy}","received_events_url":"https://api.github.com/users/tarebyte/received_events","type":"User","site_admin":false},"body":"When the user is logged in to Classroom for GitHub, we should also make sure that they have a valid access token, otherwise we should take them back to the GitHub auth page.\r\n\r\n/cc @johndbritton ","created_at":"2015-09-23T13:02:22Z","updated_at":"2015-09-24T12:41:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"45a42e3c79d409a9e54122563d5575e4b426d3c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/education/classroom/pulls/256/commits","review_comments_url":"https://api.github.com/repos/education/classroom/pulls/256/comments","review_comment_url":"https://api.github.com/repos/education/classroom/pulls/comments{/number}","comments_url":"https://api.github.com/repos/education/classroom/issues/256/comments","statuses_url":"https://api.github.com/repos/education/classroom/statuses/2929aa80def10d1de26ba14a482a4642834920b8","head":{"label":"education:user-application-authorization","ref":"user-application-authorization","sha":"2929aa80def10d1de26ba14a482a4642834920b8","user":{"login":"education","id":6667880,"avatar_url":"https://avatars.githubusercontent.com/u/6667880?v=3","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"repo":{"id":35079964,"name":"classroom","full_name":"education/classroom","owner":{"login":"education","id":6667880,"avatar_url":"https://avatars.githubusercontent.com/u/6667880?v=3","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/education/classroom","description":"Classroom for GitHub automates repository creation and access control, making it easy for teachers to distribute starter code and collect assignments on GitHub.","fork":false,"url":"https://api.github.com/repos/education/classroom","forks_url":"https://api.github.com/repos/education/classroom/forks","keys_url":"https://api.github.com/repos/education/classroom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/education/classroom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/education/classroom/teams","hooks_url":"https://api.github.com/repos/education/classroom/hooks","issue_events_url":"https://api.github.com/repos/education/classroom/issues/events{/number}","events_url":"https://api.github.com/repos/education/classroom/events","assignees_url":"https://api.github.com/repos/education/classroom/assignees{/user}","branches_url":"https://api.github.com/repos/education/classroom/branches{/branch}","tags_url":"https://api.github.com/repos/education/classroom/tags","blobs_url":"https://api.github.com/repos/education/classroom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/education/classroom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/education/classroom/git/refs{/sha}","trees_url":"https://api.github.com/repos/education/classroom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/education/classroom/statuses/{sha}","languages_url":"https://api.github.com/repos/education/classroom/languages","stargazers_url":"https://api.github.com/repos/education/classroom/stargazers","contributors_url":"https://api.github.com/repos/education/classroom/contributors","subscribers_url":"https://api.github.com/repos/education/classroom/subscribers","subscription_url":"https://api.github.com/repos/education/classroom/subscription","commits_url":"https://api.github.com/repos/education/classroom/commits{/sha}","git_commits_url":"https://api.github.com/repos/education/classroom/git/commits{/sha}","comments_url":"https://api.github.com/repos/education/classroom/comments{/number}","issue_comment_url":"https://api.github.com/repos/education/classroom/issues/comments{/number}","contents_url":"https://api.github.com/repos/education/classroom/contents/{+path}","compare_url":"https://api.github.com/repos/education/classroom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/education/classroom/merges","archive_url":"https://api.github.com/repos/education/classroom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/education/classroom/downloads","issues_url":"https://api.github.com/repos/education/classroom/issues{/number}","pulls_url":"https://api.github.com/repos/education/classroom/pulls{/number}","milestones_url":"https://api.github.com/repos/education/classroom/milestones{/number}","notifications_url":"https://api.github.com/repos/education/classroom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/education/classroom/labels{/name}","releases_url":"https://api.github.com/repos/education/classroom/releases{/id}","created_at":"2015-05-05T05:33:50Z","updated_at":"2015-09-24T12:39:58Z","pushed_at":"2015-09-24T12:38:46Z","git_url":"git://github.com/education/classroom.git","ssh_url":"git@github.com:education/classroom.git","clone_url":"https://github.com/education/classroom.git","svn_url":"https://github.com/education/classroom","homepage":"https://classroom.github.com","size":4892,"stargazers_count":146,"watchers_count":146,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":15,"forks":18,"open_issues":15,"watchers":146,"default_branch":"master"}},"base":{"label":"education:master","ref":"master","sha":"911ec833e478e157a5086064c39ec829f9a0133a","user":{"login":"education","id":6667880,"avatar_url":"https://avatars.githubusercontent.com/u/6667880?v=3","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"repo":{"id":35079964,"name":"classroom","full_name":"education/classroom","owner":{"login":"education","id":6667880,"avatar_url":"https://avatars.githubusercontent.com/u/6667880?v=3","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/education/classroom","description":"Classroom for GitHub automates repository creation and access control, making it easy for teachers to distribute starter code and collect assignments on GitHub.","fork":false,"url":"https://api.github.com/repos/education/classroom","forks_url":"https://api.github.com/repos/education/classroom/forks","keys_url":"https://api.github.com/repos/education/classroom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/education/classroom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/education/classroom/teams","hooks_url":"https://api.github.com/repos/education/classroom/hooks","issue_events_url":"https://api.github.com/repos/education/classroom/issues/events{/number}","events_url":"https://api.github.com/repos/education/classroom/events","assignees_url":"https://api.github.com/repos/education/classroom/assignees{/user}","branches_url":"https://api.github.com/repos/education/classroom/branches{/branch}","tags_url":"https://api.github.com/repos/education/classroom/tags","blobs_url":"https://api.github.com/repos/education/classroom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/education/classroom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/education/classroom/git/refs{/sha}","trees_url":"https://api.github.com/repos/education/classroom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/education/classroom/statuses/{sha}","languages_url":"https://api.github.com/repos/education/classroom/languages","stargazers_url":"https://api.github.com/repos/education/classroom/stargazers","contributors_url":"https://api.github.com/repos/education/classroom/contributors","subscribers_url":"https://api.github.com/repos/education/classroom/subscribers","subscription_url":"https://api.github.com/repos/education/classroom/subscription","commits_url":"https://api.github.com/repos/education/classroom/commits{/sha}","git_commits_url":"https://api.github.com/repos/education/classroom/git/commits{/sha}","comments_url":"https://api.github.com/repos/education/classroom/comments{/number}","issue_comment_url":"https://api.github.com/repos/education/classroom/issues/comments{/number}","contents_url":"https://api.github.com/repos/education/classroom/contents/{+path}","compare_url":"https://api.github.com/repos/education/classroom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/education/classroom/merges","archive_url":"https://api.github.com/repos/education/classroom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/education/classroom/downloads","issues_url":"https://api.github.com/repos/education/classroom/issues{/number}","pulls_url":"https://api.github.com/repos/education/classroom/pulls{/number}","milestones_url":"https://api.github.com/repos/education/classroom/milestones{/number}","notifications_url":"https://api.github.com/repos/education/classroom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/education/classroom/labels{/name}","releases_url":"https://api.github.com/repos/education/classroom/releases{/id}","created_at":"2015-05-05T05:33:50Z","updated_at":"2015-09-24T12:39:58Z","pushed_at":"2015-09-24T12:38:46Z","git_url":"git://github.com/education/classroom.git","ssh_url":"git@github.com:education/classroom.git","clone_url":"https://github.com/education/classroom.git","svn_url":"https://github.com/education/classroom","homepage":"https://classroom.github.com","size":4892,"stargazers_count":146,"watchers_count":146,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":15,"forks":18,"open_issues":15,"watchers":146,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/education/classroom/pulls/256"},"html":{"href":"https://github.com/education/classroom/pull/256"},"issue":{"href":"https://api.github.com/repos/education/classroom/issues/256"},"comments":{"href":"https://api.github.com/repos/education/classroom/issues/256/comments"},"review_comments":{"href":"https://api.github.com/repos/education/classroom/pulls/256/comments"},"review_comment":{"href":"https://api.github.com/repos/education/classroom/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/education/classroom/pulls/256/commits"},"statuses":{"href":"https://api.github.com/repos/education/classroom/statuses/2929aa80def10d1de26ba14a482a4642834920b8"}}}}