{"action":"created","comment":{"url":"https://api.github.com/repos/vajradog/myflix/pulls/comments/30007088","id":30007088,"diff_hunk":"@@ -0,0 +1,82 @@\n+require 'rails_helper'\n+\n+describe SessionsController do\n+\n+  describe 'Get new' do\n+    context 'with authenticated user' do \n+      it 'renders the new template' do \n+        session[:user_id] = nil\n+        get :new\n+        expect(response).to render_template :new\n+      end\n+    end\n+    context 'with unauthenticated user' do\n+      it 'should redirect to home_path' do \n+        session[:user_id] = Fabricate(:user).id\n+        get :new\n+        expect(response).to redirect_to home_path\n+      end\n+    end\n+  end\n+\n+  describe 'Post create' do\n+    context 'with valid credentials' do\n+      before do\n+        @thupten = Fabricate(:user)\n+        post :create, email: @thupten.email, password: @thupten.password\n+      end \n+\n+      it 'sets sessions[:user_id]' do\n+        expect(session[:user_id]).to eq(@thupten.id)\n+      end\n+\n+      it 'redirects to home_path after successful login' do\n+        expect(response).to redirect_to home_path\n+      end\n+\n+      it 'sets the notice' do\n+        expect(flash[:notice]).not_to be_blank\n+      end\n+    end\n+\n+    context 'with invalid credentials' do\n+      before do\n+        thupten = Fabricate(:user)","path":"spec/controllers/sessions_controller_spec.rb","position":44,"original_position":44,"commit_id":"49c2e00383707c86f6928d85fc908ce1a2c2c861","original_commit_id":"49c2e00383707c86f6928d85fc908ce1a2c2c861","user":{"login":"tomtomecek","id":7385469,"avatar_url":"https://avatars.githubusercontent.com/u/7385469?v=3","gravatar_id":"","url":"https://api.github.com/users/tomtomecek","html_url":"https://github.com/tomtomecek","followers_url":"https://api.github.com/users/tomtomecek/followers","following_url":"https://api.github.com/users/tomtomecek/following{/other_user}","gists_url":"https://api.github.com/users/tomtomecek/gists{/gist_id}","starred_url":"https://api.github.com/users/tomtomecek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomtomecek/subscriptions","organizations_url":"https://api.github.com/users/tomtomecek/orgs","repos_url":"https://api.github.com/users/tomtomecek/repos","events_url":"https://api.github.com/users/tomtomecek/events{/privacy}","received_events_url":"https://api.github.com/users/tomtomecek/received_events","type":"User","site_admin":false},"body":"I would recommend using `let(:thupten) { Fabricate(:user) }`, `let` allows you to lazy load and define variables for your specs. You have to use it outside the `before` block though.","created_at":"2015-05-10T22:53:28Z","updated_at":"2015-05-10T22:53:28Z","html_url":"https://github.com/vajradog/myflix/pull/5#discussion_r30007088","pull_request_url":"https://api.github.com/repos/vajradog/myflix/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/comments/30007088"},"html":{"href":"https://github.com/vajradog/myflix/pull/5#discussion_r30007088"},"pull_request":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/vajradog/myflix/pulls/5","id":35087385,"html_url":"https://github.com/vajradog/myflix/pull/5","diff_url":"https://github.com/vajradog/myflix/pull/5.diff","patch_url":"https://github.com/vajradog/myflix/pull/5.patch","issue_url":"https://api.github.com/repos/vajradog/myflix/issues/5","number":5,"state":"open","locked":false,"title":"Week2","user":{"login":"vajradog","id":3846329,"avatar_url":"https://avatars.githubusercontent.com/u/3846329?v=3","gravatar_id":"","url":"https://api.github.com/users/vajradog","html_url":"https://github.com/vajradog","followers_url":"https://api.github.com/users/vajradog/followers","following_url":"https://api.github.com/users/vajradog/following{/other_user}","gists_url":"https://api.github.com/users/vajradog/gists{/gist_id}","starred_url":"https://api.github.com/users/vajradog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vajradog/subscriptions","organizations_url":"https://api.github.com/users/vajradog/orgs","repos_url":"https://api.github.com/users/vajradog/repos","events_url":"https://api.github.com/users/vajradog/events{/privacy}","received_events_url":"https://api.github.com/users/vajradog/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-10T19:26:29Z","updated_at":"2015-05-10T22:53:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fa2df1d0e920c91068f44f4dda8f46901d37131d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/vajradog/myflix/pulls/5/commits","review_comments_url":"https://api.github.com/repos/vajradog/myflix/pulls/5/comments","review_comment_url":"https://api.github.com/repos/vajradog/myflix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vajradog/myflix/issues/5/comments","statuses_url":"https://api.github.com/repos/vajradog/myflix/statuses/49c2e00383707c86f6928d85fc908ce1a2c2c861","head":{"label":"vajradog:Week2","ref":"Week2","sha":"49c2e00383707c86f6928d85fc908ce1a2c2c861","user":{"login":"vajradog","id":3846329,"avatar_url":"https://avatars.githubusercontent.com/u/3846329?v=3","gravatar_id":"","url":"https://api.github.com/users/vajradog","html_url":"https://github.com/vajradog","followers_url":"https://api.github.com/users/vajradog/followers","following_url":"https://api.github.com/users/vajradog/following{/other_user}","gists_url":"https://api.github.com/users/vajradog/gists{/gist_id}","starred_url":"https://api.github.com/users/vajradog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vajradog/subscriptions","organizations_url":"https://api.github.com/users/vajradog/orgs","repos_url":"https://api.github.com/users/vajradog/repos","events_url":"https://api.github.com/users/vajradog/events{/privacy}","received_events_url":"https://api.github.com/users/vajradog/received_events","type":"User","site_admin":false},"repo":{"id":35118883,"name":"myflix","full_name":"vajradog/myflix","owner":{"login":"vajradog","id":3846329,"avatar_url":"https://avatars.githubusercontent.com/u/3846329?v=3","gravatar_id":"","url":"https://api.github.com/users/vajradog","html_url":"https://github.com/vajradog","followers_url":"https://api.github.com/users/vajradog/followers","following_url":"https://api.github.com/users/vajradog/following{/other_user}","gists_url":"https://api.github.com/users/vajradog/gists{/gist_id}","starred_url":"https://api.github.com/users/vajradog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vajradog/subscriptions","organizations_url":"https://api.github.com/users/vajradog/orgs","repos_url":"https://api.github.com/users/vajradog/repos","events_url":"https://api.github.com/users/vajradog/events{/privacy}","received_events_url":"https://api.github.com/users/vajradog/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vajradog/myflix","description":"","fork":false,"url":"https://api.github.com/repos/vajradog/myflix","forks_url":"https://api.github.com/repos/vajradog/myflix/forks","keys_url":"https://api.github.com/repos/vajradog/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vajradog/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vajradog/myflix/teams","hooks_url":"https://api.github.com/repos/vajradog/myflix/hooks","issue_events_url":"https://api.github.com/repos/vajradog/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/vajradog/myflix/events","assignees_url":"https://api.github.com/repos/vajradog/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/vajradog/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/vajradog/myflix/tags","blobs_url":"https://api.github.com/repos/vajradog/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vajradog/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vajradog/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/vajradog/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vajradog/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/vajradog/myflix/languages","stargazers_url":"https://api.github.com/repos/vajradog/myflix/stargazers","contributors_url":"https://api.github.com/repos/vajradog/myflix/contributors","subscribers_url":"https://api.github.com/repos/vajradog/myflix/subscribers","subscription_url":"https://api.github.com/repos/vajradog/myflix/subscription","commits_url":"https://api.github.com/repos/vajradog/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/vajradog/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/vajradog/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/vajradog/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/vajradog/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/vajradog/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vajradog/myflix/merges","archive_url":"https://api.github.com/repos/vajradog/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vajradog/myflix/downloads","issues_url":"https://api.github.com/repos/vajradog/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/vajradog/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/vajradog/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/vajradog/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vajradog/myflix/labels{/name}","releases_url":"https://api.github.com/repos/vajradog/myflix/releases{/id}","created_at":"2015-05-05T19:12:50Z","updated_at":"2015-05-08T16:15:58Z","pushed_at":"2015-05-10T19:26:29Z","git_url":"git://github.com/vajradog/myflix.git","ssh_url":"git@github.com:vajradog/myflix.git","clone_url":"https://github.com/vajradog/myflix.git","svn_url":"https://github.com/vajradog/myflix","homepage":null,"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":"vajradog:master","ref":"master","sha":"9eb75ff35bc82cb244f67b2a815bba0bdccdede2","user":{"login":"vajradog","id":3846329,"avatar_url":"https://avatars.githubusercontent.com/u/3846329?v=3","gravatar_id":"","url":"https://api.github.com/users/vajradog","html_url":"https://github.com/vajradog","followers_url":"https://api.github.com/users/vajradog/followers","following_url":"https://api.github.com/users/vajradog/following{/other_user}","gists_url":"https://api.github.com/users/vajradog/gists{/gist_id}","starred_url":"https://api.github.com/users/vajradog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vajradog/subscriptions","organizations_url":"https://api.github.com/users/vajradog/orgs","repos_url":"https://api.github.com/users/vajradog/repos","events_url":"https://api.github.com/users/vajradog/events{/privacy}","received_events_url":"https://api.github.com/users/vajradog/received_events","type":"User","site_admin":false},"repo":{"id":35118883,"name":"myflix","full_name":"vajradog/myflix","owner":{"login":"vajradog","id":3846329,"avatar_url":"https://avatars.githubusercontent.com/u/3846329?v=3","gravatar_id":"","url":"https://api.github.com/users/vajradog","html_url":"https://github.com/vajradog","followers_url":"https://api.github.com/users/vajradog/followers","following_url":"https://api.github.com/users/vajradog/following{/other_user}","gists_url":"https://api.github.com/users/vajradog/gists{/gist_id}","starred_url":"https://api.github.com/users/vajradog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vajradog/subscriptions","organizations_url":"https://api.github.com/users/vajradog/orgs","repos_url":"https://api.github.com/users/vajradog/repos","events_url":"https://api.github.com/users/vajradog/events{/privacy}","received_events_url":"https://api.github.com/users/vajradog/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vajradog/myflix","description":"","fork":false,"url":"https://api.github.com/repos/vajradog/myflix","forks_url":"https://api.github.com/repos/vajradog/myflix/forks","keys_url":"https://api.github.com/repos/vajradog/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vajradog/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vajradog/myflix/teams","hooks_url":"https://api.github.com/repos/vajradog/myflix/hooks","issue_events_url":"https://api.github.com/repos/vajradog/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/vajradog/myflix/events","assignees_url":"https://api.github.com/repos/vajradog/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/vajradog/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/vajradog/myflix/tags","blobs_url":"https://api.github.com/repos/vajradog/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vajradog/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vajradog/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/vajradog/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vajradog/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/vajradog/myflix/languages","stargazers_url":"https://api.github.com/repos/vajradog/myflix/stargazers","contributors_url":"https://api.github.com/repos/vajradog/myflix/contributors","subscribers_url":"https://api.github.com/repos/vajradog/myflix/subscribers","subscription_url":"https://api.github.com/repos/vajradog/myflix/subscription","commits_url":"https://api.github.com/repos/vajradog/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/vajradog/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/vajradog/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/vajradog/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/vajradog/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/vajradog/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vajradog/myflix/merges","archive_url":"https://api.github.com/repos/vajradog/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vajradog/myflix/downloads","issues_url":"https://api.github.com/repos/vajradog/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/vajradog/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/vajradog/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/vajradog/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vajradog/myflix/labels{/name}","releases_url":"https://api.github.com/repos/vajradog/myflix/releases{/id}","created_at":"2015-05-05T19:12:50Z","updated_at":"2015-05-08T16:15:58Z","pushed_at":"2015-05-10T19:26:29Z","git_url":"git://github.com/vajradog/myflix.git","ssh_url":"git@github.com:vajradog/myflix.git","clone_url":"https://github.com/vajradog/myflix.git","svn_url":"https://github.com/vajradog/myflix","homepage":null,"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/vajradog/myflix/pulls/5"},"html":{"href":"https://github.com/vajradog/myflix/pull/5"},"issue":{"href":"https://api.github.com/repos/vajradog/myflix/issues/5"},"comments":{"href":"https://api.github.com/repos/vajradog/myflix/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/vajradog/myflix/statuses/49c2e00383707c86f6928d85fc908ce1a2c2c861"}}}}