{"action":"created","comment":{"url":"https://api.github.com/repos/sd-kin/vote/pulls/comments/83016985","pull_request_review_id":3879666,"id":83016985,"diff_hunk":"@@ -0,0 +1,117 @@\n+# frozen_string_literal: true\n+require 'rails_helper'\n+\n+RSpec.describe CommentsController, type: :controller do\n+  let!(:comment) { FactoryGirl.create :comment }\n+  let(:commented_comment) { FactoryGirl.create :comment, :with_comments }\n+  let(:comment_params) { FactoryGirl.attributes_for :comment }\n+  let(:poll) { FactoryGirl.create :valid_poll }\n+  let(:user) { FactoryGirl.create :user }\n+  let(:anonimous_user) { User.create_anonimous! }\n+\n+  describe 'GET#new' do\n+    subject { xhr :get, :new, comment_id: comment }\n+\n+    it { is_expected.to be_success }\n+  end\n+\n+  describe 'POST#create' do\n+    before(:each) { session[:user_id] = user.id }\n+\n+    context 'when poll commented' do\n+      subject { xhr :post, :create, poll_id: poll, comment: comment_params }\n+\n+      it { is_expected.to be_success }\n+\n+      it 'have poll as commentable' do\n+        subject\n+        expect(assigns(:commentable)).to be_a(Poll)\n+      end\n+\n+      it 'increase comments counter' do\n+        expect { subject }.to change { Comment.count }.by(1)\n+      end\n+\n+      it 'increase polls comments counter' do\n+        expect { subject }.to change { poll.reload.comments.count }.by(1)\n+      end\n+    end\n+\n+    context 'when comment commented' do\n+      subject { xhr :post, :create, comment_id: comment, comment: comment_params }\n+\n+      it { is_expected.to be_success }\n+\n+      it 'have comment as commentable' do\n+        subject\n+        expect(assigns(:commentable)).to be_a(Comment)\n+      end\n+\n+      it 'increase comments counter' do\n+        expect { subject }.to change { Comment.count }.by(1)\n+      end\n+\n+      it 'increase polls comments counter' do\n+        expect { subject }.to change { comment.reload.comments.count }.by(1)\n+      end\n+    end\n+\n+    context 'when user logged in' do\n+      subject { xhr :post, :create, comment_id: comment, comment: comment_params }\n+      before(:each) { session[:user_id] = user.id }","path":"spec/controllers/comments_controller_spec.rb","position":61,"original_position":61,"commit_id":"aac16c282c16759e28ba55ef33703966e56ab962","original_commit_id":"aac16c282c16759e28ba55ef33703966e56ab962","user":{"login":"kirushik","id":152719,"avatar_url":"https://avatars.githubusercontent.com/u/152719?v=3","gravatar_id":"","url":"https://api.github.com/users/kirushik","html_url":"https://github.com/kirushik","followers_url":"https://api.github.com/users/kirushik/followers","following_url":"https://api.github.com/users/kirushik/following{/other_user}","gists_url":"https://api.github.com/users/kirushik/gists{/gist_id}","starred_url":"https://api.github.com/users/kirushik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirushik/subscriptions","organizations_url":"https://api.github.com/users/kirushik/orgs","repos_url":"https://api.github.com/users/kirushik/repos","events_url":"https://api.github.com/users/kirushik/events{/privacy}","received_events_url":"https://api.github.com/users/kirushik/received_events","type":"User","site_admin":false},"body":"You already have this on line 19.","created_at":"2016-10-12T14:26:37Z","updated_at":"2016-10-12T14:26:37Z","html_url":"https://github.com/sd-kin/vote/pull/80#discussion_r83016985","pull_request_url":"https://api.github.com/repos/sd-kin/vote/pulls/80","_links":{"self":{"href":"https://api.github.com/repos/sd-kin/vote/pulls/comments/83016985"},"html":{"href":"https://github.com/sd-kin/vote/pull/80#discussion_r83016985"},"pull_request":{"href":"https://api.github.com/repos/sd-kin/vote/pulls/80"}}},"pull_request":{"url":"https://api.github.com/repos/sd-kin/vote/pulls/80","id":88883733,"html_url":"https://github.com/sd-kin/vote/pull/80","diff_url":"https://github.com/sd-kin/vote/pull/80.diff","patch_url":"https://github.com/sd-kin/vote/pull/80.patch","issue_url":"https://api.github.com/repos/sd-kin/vote/issues/80","number":80,"state":"open","locked":false,"title":"Add comments","user":{"login":"sd-kin","id":13506257,"avatar_url":"https://avatars.githubusercontent.com/u/13506257?v=3","gravatar_id":"","url":"https://api.github.com/users/sd-kin","html_url":"https://github.com/sd-kin","followers_url":"https://api.github.com/users/sd-kin/followers","following_url":"https://api.github.com/users/sd-kin/following{/other_user}","gists_url":"https://api.github.com/users/sd-kin/gists{/gist_id}","starred_url":"https://api.github.com/users/sd-kin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sd-kin/subscriptions","organizations_url":"https://api.github.com/users/sd-kin/orgs","repos_url":"https://api.github.com/users/sd-kin/repos","events_url":"https://api.github.com/users/sd-kin/events{/privacy}","received_events_url":"https://api.github.com/users/sd-kin/received_events","type":"User","site_admin":false},"body":" closes #30 closes #73 closes #75 ","created_at":"2016-10-11T18:19:29Z","updated_at":"2016-10-12T14:31:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e387e6fcf863a620bf8505c102af6f123e62763","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sd-kin/vote/pulls/80/commits","review_comments_url":"https://api.github.com/repos/sd-kin/vote/pulls/80/comments","review_comment_url":"https://api.github.com/repos/sd-kin/vote/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sd-kin/vote/issues/80/comments","statuses_url":"https://api.github.com/repos/sd-kin/vote/statuses/aac16c282c16759e28ba55ef33703966e56ab962","head":{"label":"sd-kin:add_comments","ref":"add_comments","sha":"aac16c282c16759e28ba55ef33703966e56ab962","user":{"login":"sd-kin","id":13506257,"avatar_url":"https://avatars.githubusercontent.com/u/13506257?v=3","gravatar_id":"","url":"https://api.github.com/users/sd-kin","html_url":"https://github.com/sd-kin","followers_url":"https://api.github.com/users/sd-kin/followers","following_url":"https://api.github.com/users/sd-kin/following{/other_user}","gists_url":"https://api.github.com/users/sd-kin/gists{/gist_id}","starred_url":"https://api.github.com/users/sd-kin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sd-kin/subscriptions","organizations_url":"https://api.github.com/users/sd-kin/orgs","repos_url":"https://api.github.com/users/sd-kin/repos","events_url":"https://api.github.com/users/sd-kin/events{/privacy}","received_events_url":"https://api.github.com/users/sd-kin/received_events","type":"User","site_admin":false},"repo":{"id":46409201,"name":"vote","full_name":"sd-kin/vote","owner":{"login":"sd-kin","id":13506257,"avatar_url":"https://avatars.githubusercontent.com/u/13506257?v=3","gravatar_id":"","url":"https://api.github.com/users/sd-kin","html_url":"https://github.com/sd-kin","followers_url":"https://api.github.com/users/sd-kin/followers","following_url":"https://api.github.com/users/sd-kin/following{/other_user}","gists_url":"https://api.github.com/users/sd-kin/gists{/gist_id}","starred_url":"https://api.github.com/users/sd-kin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sd-kin/subscriptions","organizations_url":"https://api.github.com/users/sd-kin/orgs","repos_url":"https://api.github.com/users/sd-kin/repos","events_url":"https://api.github.com/users/sd-kin/events{/privacy}","received_events_url":"https://api.github.com/users/sd-kin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sd-kin/vote","description":"","fork":false,"url":"https://api.github.com/repos/sd-kin/vote","forks_url":"https://api.github.com/repos/sd-kin/vote/forks","keys_url":"https://api.github.com/repos/sd-kin/vote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sd-kin/vote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sd-kin/vote/teams","hooks_url":"https://api.github.com/repos/sd-kin/vote/hooks","issue_events_url":"https://api.github.com/repos/sd-kin/vote/issues/events{/number}","events_url":"https://api.github.com/repos/sd-kin/vote/events","assignees_url":"https://api.github.com/repos/sd-kin/vote/assignees{/user}","branches_url":"https://api.github.com/repos/sd-kin/vote/branches{/branch}","tags_url":"https://api.github.com/repos/sd-kin/vote/tags","blobs_url":"https://api.github.com/repos/sd-kin/vote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sd-kin/vote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sd-kin/vote/git/refs{/sha}","trees_url":"https://api.github.com/repos/sd-kin/vote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sd-kin/vote/statuses/{sha}","languages_url":"https://api.github.com/repos/sd-kin/vote/languages","stargazers_url":"https://api.github.com/repos/sd-kin/vote/stargazers","contributors_url":"https://api.github.com/repos/sd-kin/vote/contributors","subscribers_url":"https://api.github.com/repos/sd-kin/vote/subscribers","subscription_url":"https://api.github.com/repos/sd-kin/vote/subscription","commits_url":"https://api.github.com/repos/sd-kin/vote/commits{/sha}","git_commits_url":"https://api.github.com/repos/sd-kin/vote/git/commits{/sha}","comments_url":"https://api.github.com/repos/sd-kin/vote/comments{/number}","issue_comment_url":"https://api.github.com/repos/sd-kin/vote/issues/comments{/number}","contents_url":"https://api.github.com/repos/sd-kin/vote/contents/{+path}","compare_url":"https://api.github.com/repos/sd-kin/vote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sd-kin/vote/merges","archive_url":"https://api.github.com/repos/sd-kin/vote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sd-kin/vote/downloads","issues_url":"https://api.github.com/repos/sd-kin/vote/issues{/number}","pulls_url":"https://api.github.com/repos/sd-kin/vote/pulls{/number}","milestones_url":"https://api.github.com/repos/sd-kin/vote/milestones{/number}","notifications_url":"https://api.github.com/repos/sd-kin/vote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sd-kin/vote/labels{/name}","releases_url":"https://api.github.com/repos/sd-kin/vote/releases{/id}","deployments_url":"https://api.github.com/repos/sd-kin/vote/deployments","created_at":"2015-11-18T09:41:01Z","updated_at":"2016-05-27T10:07:17Z","pushed_at":"2016-10-11T18:19:29Z","git_url":"git://github.com/sd-kin/vote.git","ssh_url":"git@github.com:sd-kin/vote.git","clone_url":"https://github.com/sd-kin/vote.git","svn_url":"https://github.com/sd-kin/vote","homepage":null,"size":346,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":21,"forks":1,"open_issues":21,"watchers":0,"default_branch":"master"}},"base":{"label":"sd-kin:master","ref":"master","sha":"4cd72a49933951aa175bb4cff6176e35ac188362","user":{"login":"sd-kin","id":13506257,"avatar_url":"https://avatars.githubusercontent.com/u/13506257?v=3","gravatar_id":"","url":"https://api.github.com/users/sd-kin","html_url":"https://github.com/sd-kin","followers_url":"https://api.github.com/users/sd-kin/followers","following_url":"https://api.github.com/users/sd-kin/following{/other_user}","gists_url":"https://api.github.com/users/sd-kin/gists{/gist_id}","starred_url":"https://api.github.com/users/sd-kin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sd-kin/subscriptions","organizations_url":"https://api.github.com/users/sd-kin/orgs","repos_url":"https://api.github.com/users/sd-kin/repos","events_url":"https://api.github.com/users/sd-kin/events{/privacy}","received_events_url":"https://api.github.com/users/sd-kin/received_events","type":"User","site_admin":false},"repo":{"id":46409201,"name":"vote","full_name":"sd-kin/vote","owner":{"login":"sd-kin","id":13506257,"avatar_url":"https://avatars.githubusercontent.com/u/13506257?v=3","gravatar_id":"","url":"https://api.github.com/users/sd-kin","html_url":"https://github.com/sd-kin","followers_url":"https://api.github.com/users/sd-kin/followers","following_url":"https://api.github.com/users/sd-kin/following{/other_user}","gists_url":"https://api.github.com/users/sd-kin/gists{/gist_id}","starred_url":"https://api.github.com/users/sd-kin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sd-kin/subscriptions","organizations_url":"https://api.github.com/users/sd-kin/orgs","repos_url":"https://api.github.com/users/sd-kin/repos","events_url":"https://api.github.com/users/sd-kin/events{/privacy}","received_events_url":"https://api.github.com/users/sd-kin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sd-kin/vote","description":"","fork":false,"url":"https://api.github.com/repos/sd-kin/vote","forks_url":"https://api.github.com/repos/sd-kin/vote/forks","keys_url":"https://api.github.com/repos/sd-kin/vote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sd-kin/vote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sd-kin/vote/teams","hooks_url":"https://api.github.com/repos/sd-kin/vote/hooks","issue_events_url":"https://api.github.com/repos/sd-kin/vote/issues/events{/number}","events_url":"https://api.github.com/repos/sd-kin/vote/events","assignees_url":"https://api.github.com/repos/sd-kin/vote/assignees{/user}","branches_url":"https://api.github.com/repos/sd-kin/vote/branches{/branch}","tags_url":"https://api.github.com/repos/sd-kin/vote/tags","blobs_url":"https://api.github.com/repos/sd-kin/vote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sd-kin/vote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sd-kin/vote/git/refs{/sha}","trees_url":"https://api.github.com/repos/sd-kin/vote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sd-kin/vote/statuses/{sha}","languages_url":"https://api.github.com/repos/sd-kin/vote/languages","stargazers_url":"https://api.github.com/repos/sd-kin/vote/stargazers","contributors_url":"https://api.github.com/repos/sd-kin/vote/contributors","subscribers_url":"https://api.github.com/repos/sd-kin/vote/subscribers","subscription_url":"https://api.github.com/repos/sd-kin/vote/subscription","commits_url":"https://api.github.com/repos/sd-kin/vote/commits{/sha}","git_commits_url":"https://api.github.com/repos/sd-kin/vote/git/commits{/sha}","comments_url":"https://api.github.com/repos/sd-kin/vote/comments{/number}","issue_comment_url":"https://api.github.com/repos/sd-kin/vote/issues/comments{/number}","contents_url":"https://api.github.com/repos/sd-kin/vote/contents/{+path}","compare_url":"https://api.github.com/repos/sd-kin/vote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sd-kin/vote/merges","archive_url":"https://api.github.com/repos/sd-kin/vote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sd-kin/vote/downloads","issues_url":"https://api.github.com/repos/sd-kin/vote/issues{/number}","pulls_url":"https://api.github.com/repos/sd-kin/vote/pulls{/number}","milestones_url":"https://api.github.com/repos/sd-kin/vote/milestones{/number}","notifications_url":"https://api.github.com/repos/sd-kin/vote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sd-kin/vote/labels{/name}","releases_url":"https://api.github.com/repos/sd-kin/vote/releases{/id}","deployments_url":"https://api.github.com/repos/sd-kin/vote/deployments","created_at":"2015-11-18T09:41:01Z","updated_at":"2016-05-27T10:07:17Z","pushed_at":"2016-10-11T18:19:29Z","git_url":"git://github.com/sd-kin/vote.git","ssh_url":"git@github.com:sd-kin/vote.git","clone_url":"https://github.com/sd-kin/vote.git","svn_url":"https://github.com/sd-kin/vote","homepage":null,"size":346,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":21,"forks":1,"open_issues":21,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sd-kin/vote/pulls/80"},"html":{"href":"https://github.com/sd-kin/vote/pull/80"},"issue":{"href":"https://api.github.com/repos/sd-kin/vote/issues/80"},"comments":{"href":"https://api.github.com/repos/sd-kin/vote/issues/80/comments"},"review_comments":{"href":"https://api.github.com/repos/sd-kin/vote/pulls/80/comments"},"review_comment":{"href":"https://api.github.com/repos/sd-kin/vote/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sd-kin/vote/pulls/80/commits"},"statuses":{"href":"https://api.github.com/repos/sd-kin/vote/statuses/aac16c282c16759e28ba55ef33703966e56ab962"}}}}
{"actor":{"display_login":"kirushik"}}