{"action":"created","comment":{"url":"https://api.github.com/repos/vajradog/myflix/pulls/comments/31373551","id":31373551,"diff_hunk":"@@ -0,0 +1,56 @@\n+require 'rails_helper'\n+\n+describe ForgotPasswordsController do\n+  describe \"POST create\" do\n+    context \"with blank input\" do\n+      it \"redirects to the forgot password page\" do\n+        post :create, { email: \"\" }\n+        expect(response).to redirect_to forgot_password_path\n+      end\n+\n+      it \"shows an error\" do \n+        post :create, { email: \"\" }\n+        expect(flash[:error]).to eq(\"Email cannot be blank\")\n+      end\n+    end\n+\n+    context \"with existing email\" do\n+      it \"redirects to forgot password confirmation page\" do\n+        Fabricate(:user, email: \"john@example.com\")\n+        post :create, { email: \"john@example.com\" }\n+        expect(response).to redirect_to forgot_password_confirmation_path\n+      end\n+\n+      it \"generates token\" do\n+        Fabricate(:user, email: \"john@example.com\")\n+        post :create, { email: \"john@example.com\" }\n+        expect(assigns(:token)).to be_present\n+      end\n+\n+      it \"sends email to the users email address\" do \n+        Fabricate(:user, email: \"john@example.com\")\n+        post :create, { email: \"john@example.com\" }\n+        expect(ActionMailer::Base.deliveries.last.to).to eq([\"john@example.com\"])\n+      end\n+\n+      it \"sends email with the token\" do\n+        john = Fabricate(:user, email: \"john@example.com\")\n+        post :create, { email: john.email }\n+        message = ActionMailer::Base.deliveries.last\n+        expect(message.body).to include(john.token)\n+      end\n+    end\n+\n+    context \"with non-existing email\" do\n+      it \"redirects to the forgot password page\" do\n+        post :create, { email: \"hello@example.com\" }\n+        expect(response).to redirect_to forgot_password_path\n+      end\n+\n+      it \"shows an error\" do \n+        post :create, { email: \"hello@example.com\" }\n+        expect(flash[:error]).to eq(\"Email does not exist in our system\")","path":"spec/controllers/forgot_passwords_spec.rb","position":52,"original_position":52,"commit_id":"7f740799c637cf71f8c8e2bb60ef74ad4280a00e","original_commit_id":"7f740799c637cf71f8c8e2bb60ef74ad4280a00e","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":"Testing flash messages content should be left out to feature specs.","created_at":"2015-05-29T23:39:48Z","updated_at":"2015-05-29T23:39:48Z","html_url":"https://github.com/vajradog/myflix/pull/11#discussion_r31373551","pull_request_url":"https://api.github.com/repos/vajradog/myflix/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/comments/31373551"},"html":{"href":"https://github.com/vajradog/myflix/pull/11#discussion_r31373551"},"pull_request":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/vajradog/myflix/pulls/11","id":36552564,"html_url":"https://github.com/vajradog/myflix/pull/11","diff_url":"https://github.com/vajradog/myflix/pull/11.diff","patch_url":"https://github.com/vajradog/myflix/pull/11.patch","issue_url":"https://api.github.com/repos/vajradog/myflix/issues/11","number":11,"state":"open","locked":false,"title":"Week4","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-29T23:02:16Z","updated_at":"2015-05-29T23:39:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/vajradog/myflix/pulls/11/commits","review_comments_url":"https://api.github.com/repos/vajradog/myflix/pulls/11/comments","review_comment_url":"https://api.github.com/repos/vajradog/myflix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vajradog/myflix/issues/11/comments","statuses_url":"https://api.github.com/repos/vajradog/myflix/statuses/7f740799c637cf71f8c8e2bb60ef74ad4280a00e","head":{"label":"vajradog:Week4","ref":"Week4","sha":"7f740799c637cf71f8c8e2bb60ef74ad4280a00e","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-29T23:06:01Z","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":1864,"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":"4d275c4acc55e68ce59643949120d98395ce7344","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-29T23:06:01Z","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":1864,"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/11"},"html":{"href":"https://github.com/vajradog/myflix/pull/11"},"issue":{"href":"https://api.github.com/repos/vajradog/myflix/issues/11"},"comments":{"href":"https://api.github.com/repos/vajradog/myflix/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vajradog/myflix/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/vajradog/myflix/statuses/7f740799c637cf71f8c8e2bb60ef74ad4280a00e"}}}}