{"action":"created","comment":{"url":"https://api.github.com/repos/figocia/myflix/pulls/comments/31806084","id":31806084,"diff_hunk":"@@ -3,49 +3,73 @@\n describe UsersController do \n \n   describe 'GET New' do\n-    it 'should create a new instance of User' do\n+    it 'creates a new instance of User' do\n       get :new\n-      assigns(:user).should be_an_instance_of User\n+      expect(assigns(:user)).to be_an_instance_of User\n     end\n        \n   end\n   \n-  describe 'POST Create' do    \n-    it 'should create user successfuly if registration successful' do\n-      post :create, user:{email: 'example@123.com', password: '12345'}\n-      expect(User.count).to eq(1)\n+  describe 'POST Create' do\n+    before do\n+      charge = double(:charge, successful?: true)        \n+      StripeWrapper::Charge.stub(:create).and_return(charge)        \n     end\n+    context 'with valid credit card' do      \n+      it 'creates user successfuly if registration successful' do\n+        post :create, user:{email: 'example@123.com', password: '12345'}, stripeToken: '123'\n+        expect(User.count).to eq(1)\n+      end\n \n-    it 'should redirect to sign in path after register' do\n-      post :create, user:{email: 'example@123.com', password: '12345'}    \n-      response.should redirect_to login_path\n-    end\n-    \n-    it 'should fail if email is not valid' do \n-      post :create, user:{email: '', password: '12345'}\n-      expect(User.count).to eq(0)\n+      it 'redirects to sign in path after register' do\n+        post :create, user:{email: 'example@123.com', password: '12345'}, stripeToken: '123'    \n+        expect(response).to redirect_to home_path\n+      end\n+      \n+      it 'fails if email is not valid' do \n+        post :create, user:{email: '', password: '12345'}, stripeToken: '123'\n+        expect(User.count).to eq(0)\n+      end\n+      \n+      it 'fails if password is not valid' do\n+        post :create, user:{email: 'example@example.com', password: '123'}, stripeToken: '123'\n+        expect(User.count).to eq(0)\n+      end  \n     end\n     \n-    it 'should fail if password is not valid' do\n-      post :create, user:{email: 'example@example.com', password: '123'}\n-      expect(User.count).to eq(0)\n+    context 'with invalid credit card' do\n+      before do\n+        charge = double(:charge, successful?: false, error_message: 'Your card was declined.')\n+        StripeWrapper::Charge.stub(:create).and_return(charge)\n+      end\n+      it 'does not create the user' do\n+        post :create, user:{email: 'example@example.com', password: '12345'}, stripeToken: '123'\n+        expect(User.count).to eq(0)\n+      end","path":"spec/controllers/users_controller_spec.rb","position":63,"original_position":63,"commit_id":"e945f91e84b6d6bfd6259bf73160c79290706ec0","original_commit_id":"e945f91e84b6d6bfd6259bf73160c79290706ec0","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":"There should be empty line between spec examples.","created_at":"2015-06-05T11:46:56Z","updated_at":"2015-06-05T11:46:56Z","html_url":"https://github.com/figocia/myflix/pull/9#discussion_r31806084","pull_request_url":"https://api.github.com/repos/figocia/myflix/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/figocia/myflix/pulls/comments/31806084"},"html":{"href":"https://github.com/figocia/myflix/pull/9#discussion_r31806084"},"pull_request":{"href":"https://api.github.com/repos/figocia/myflix/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/figocia/myflix/pulls/9","id":36996689,"html_url":"https://github.com/figocia/myflix/pull/9","diff_url":"https://github.com/figocia/myflix/pull/9.diff","patch_url":"https://github.com/figocia/myflix/pull/9.patch","issue_url":"https://api.github.com/repos/figocia/myflix/issues/9","number":9,"state":"open","locked":false,"title":"Week7","user":{"login":"figocia","id":650360,"avatar_url":"https://avatars.githubusercontent.com/u/650360?v=3","gravatar_id":"","url":"https://api.github.com/users/figocia","html_url":"https://github.com/figocia","followers_url":"https://api.github.com/users/figocia/followers","following_url":"https://api.github.com/users/figocia/following{/other_user}","gists_url":"https://api.github.com/users/figocia/gists{/gist_id}","starred_url":"https://api.github.com/users/figocia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/figocia/subscriptions","organizations_url":"https://api.github.com/users/figocia/orgs","repos_url":"https://api.github.com/users/figocia/repos","events_url":"https://api.github.com/users/figocia/events{/privacy}","received_events_url":"https://api.github.com/users/figocia/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-05T02:41:45Z","updated_at":"2015-06-05T11:46:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9a4b53b6ce8ce9e8b740ab2b4d9031be3fd0c48","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/figocia/myflix/pulls/9/commits","review_comments_url":"https://api.github.com/repos/figocia/myflix/pulls/9/comments","review_comment_url":"https://api.github.com/repos/figocia/myflix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/figocia/myflix/issues/9/comments","statuses_url":"https://api.github.com/repos/figocia/myflix/statuses/e945f91e84b6d6bfd6259bf73160c79290706ec0","head":{"label":"figocia:week7","ref":"week7","sha":"e945f91e84b6d6bfd6259bf73160c79290706ec0","user":{"login":"figocia","id":650360,"avatar_url":"https://avatars.githubusercontent.com/u/650360?v=3","gravatar_id":"","url":"https://api.github.com/users/figocia","html_url":"https://github.com/figocia","followers_url":"https://api.github.com/users/figocia/followers","following_url":"https://api.github.com/users/figocia/following{/other_user}","gists_url":"https://api.github.com/users/figocia/gists{/gist_id}","starred_url":"https://api.github.com/users/figocia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/figocia/subscriptions","organizations_url":"https://api.github.com/users/figocia/orgs","repos_url":"https://api.github.com/users/figocia/repos","events_url":"https://api.github.com/users/figocia/events{/privacy}","received_events_url":"https://api.github.com/users/figocia/received_events","type":"User","site_admin":false},"repo":{"id":20631477,"name":"myflix","full_name":"figocia/myflix","owner":{"login":"figocia","id":650360,"avatar_url":"https://avatars.githubusercontent.com/u/650360?v=3","gravatar_id":"","url":"https://api.github.com/users/figocia","html_url":"https://github.com/figocia","followers_url":"https://api.github.com/users/figocia/followers","following_url":"https://api.github.com/users/figocia/following{/other_user}","gists_url":"https://api.github.com/users/figocia/gists{/gist_id}","starred_url":"https://api.github.com/users/figocia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/figocia/subscriptions","organizations_url":"https://api.github.com/users/figocia/orgs","repos_url":"https://api.github.com/users/figocia/repos","events_url":"https://api.github.com/users/figocia/events{/privacy}","received_events_url":"https://api.github.com/users/figocia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/figocia/myflix","description":"","fork":true,"url":"https://api.github.com/repos/figocia/myflix","forks_url":"https://api.github.com/repos/figocia/myflix/forks","keys_url":"https://api.github.com/repos/figocia/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/figocia/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/figocia/myflix/teams","hooks_url":"https://api.github.com/repos/figocia/myflix/hooks","issue_events_url":"https://api.github.com/repos/figocia/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/figocia/myflix/events","assignees_url":"https://api.github.com/repos/figocia/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/figocia/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/figocia/myflix/tags","blobs_url":"https://api.github.com/repos/figocia/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/figocia/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/figocia/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/figocia/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/figocia/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/figocia/myflix/languages","stargazers_url":"https://api.github.com/repos/figocia/myflix/stargazers","contributors_url":"https://api.github.com/repos/figocia/myflix/contributors","subscribers_url":"https://api.github.com/repos/figocia/myflix/subscribers","subscription_url":"https://api.github.com/repos/figocia/myflix/subscription","commits_url":"https://api.github.com/repos/figocia/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/figocia/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/figocia/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/figocia/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/figocia/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/figocia/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/figocia/myflix/merges","archive_url":"https://api.github.com/repos/figocia/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/figocia/myflix/downloads","issues_url":"https://api.github.com/repos/figocia/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/figocia/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/figocia/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/figocia/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/figocia/myflix/labels{/name}","releases_url":"https://api.github.com/repos/figocia/myflix/releases{/id}","created_at":"2014-06-09T01:55:00Z","updated_at":"2015-05-06T22:08:59Z","pushed_at":"2015-06-05T02:41:45Z","git_url":"git://github.com/figocia/myflix.git","ssh_url":"git@github.com:figocia/myflix.git","clone_url":"https://github.com/figocia/myflix.git","svn_url":"https://github.com/figocia/myflix","homepage":null,"size":1686,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"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":"figocia:master","ref":"master","sha":"3555330da82e121550558ed8fd671d832520d961","user":{"login":"figocia","id":650360,"avatar_url":"https://avatars.githubusercontent.com/u/650360?v=3","gravatar_id":"","url":"https://api.github.com/users/figocia","html_url":"https://github.com/figocia","followers_url":"https://api.github.com/users/figocia/followers","following_url":"https://api.github.com/users/figocia/following{/other_user}","gists_url":"https://api.github.com/users/figocia/gists{/gist_id}","starred_url":"https://api.github.com/users/figocia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/figocia/subscriptions","organizations_url":"https://api.github.com/users/figocia/orgs","repos_url":"https://api.github.com/users/figocia/repos","events_url":"https://api.github.com/users/figocia/events{/privacy}","received_events_url":"https://api.github.com/users/figocia/received_events","type":"User","site_admin":false},"repo":{"id":20631477,"name":"myflix","full_name":"figocia/myflix","owner":{"login":"figocia","id":650360,"avatar_url":"https://avatars.githubusercontent.com/u/650360?v=3","gravatar_id":"","url":"https://api.github.com/users/figocia","html_url":"https://github.com/figocia","followers_url":"https://api.github.com/users/figocia/followers","following_url":"https://api.github.com/users/figocia/following{/other_user}","gists_url":"https://api.github.com/users/figocia/gists{/gist_id}","starred_url":"https://api.github.com/users/figocia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/figocia/subscriptions","organizations_url":"https://api.github.com/users/figocia/orgs","repos_url":"https://api.github.com/users/figocia/repos","events_url":"https://api.github.com/users/figocia/events{/privacy}","received_events_url":"https://api.github.com/users/figocia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/figocia/myflix","description":"","fork":true,"url":"https://api.github.com/repos/figocia/myflix","forks_url":"https://api.github.com/repos/figocia/myflix/forks","keys_url":"https://api.github.com/repos/figocia/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/figocia/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/figocia/myflix/teams","hooks_url":"https://api.github.com/repos/figocia/myflix/hooks","issue_events_url":"https://api.github.com/repos/figocia/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/figocia/myflix/events","assignees_url":"https://api.github.com/repos/figocia/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/figocia/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/figocia/myflix/tags","blobs_url":"https://api.github.com/repos/figocia/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/figocia/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/figocia/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/figocia/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/figocia/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/figocia/myflix/languages","stargazers_url":"https://api.github.com/repos/figocia/myflix/stargazers","contributors_url":"https://api.github.com/repos/figocia/myflix/contributors","subscribers_url":"https://api.github.com/repos/figocia/myflix/subscribers","subscription_url":"https://api.github.com/repos/figocia/myflix/subscription","commits_url":"https://api.github.com/repos/figocia/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/figocia/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/figocia/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/figocia/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/figocia/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/figocia/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/figocia/myflix/merges","archive_url":"https://api.github.com/repos/figocia/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/figocia/myflix/downloads","issues_url":"https://api.github.com/repos/figocia/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/figocia/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/figocia/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/figocia/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/figocia/myflix/labels{/name}","releases_url":"https://api.github.com/repos/figocia/myflix/releases{/id}","created_at":"2014-06-09T01:55:00Z","updated_at":"2015-05-06T22:08:59Z","pushed_at":"2015-06-05T02:41:45Z","git_url":"git://github.com/figocia/myflix.git","ssh_url":"git@github.com:figocia/myflix.git","clone_url":"https://github.com/figocia/myflix.git","svn_url":"https://github.com/figocia/myflix","homepage":null,"size":1686,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"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/figocia/myflix/pulls/9"},"html":{"href":"https://github.com/figocia/myflix/pull/9"},"issue":{"href":"https://api.github.com/repos/figocia/myflix/issues/9"},"comments":{"href":"https://api.github.com/repos/figocia/myflix/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/figocia/myflix/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/figocia/myflix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/figocia/myflix/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/figocia/myflix/statuses/e945f91e84b6d6bfd6259bf73160c79290706ec0"}}}}