{"action":"created","comment":{"url":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/comments/31604229","id":31604229,"diff_hunk":"@@ -0,0 +1,37 @@\n+require 'rails_helper'\n+\n+RSpec.describe AnswersController, type: :controller do\n+\n+  let(:question) { FactoryGirl.create(:question) }\n+  let(:answer) { create(:answer) }\n+\n+  describe 'POST #create' do\n+\n+    context 'with valid attributes' do\n+\n+      it 'saves answer in database' do\n+        expect { post :create, question_id: question, answer: attributes_for(:answer) }.to change(Answer, :count).by(1)\n+        expect(Answer.last.question_id).to eq question.id","path":"spec/controllers/answers_controller_spec.rb","position":14,"original_position":14,"commit_id":"2619161646791da492ed83f91540bb104e21e8f8","original_commit_id":"2619161646791da492ed83f91540bb104e21e8f8","user":{"login":"vkurennov","id":968537,"avatar_url":"https://avatars.githubusercontent.com/u/968537?v=3","gravatar_id":"","url":"https://api.github.com/users/vkurennov","html_url":"https://github.com/vkurennov","followers_url":"https://api.github.com/users/vkurennov/followers","following_url":"https://api.github.com/users/vkurennov/following{/other_user}","gists_url":"https://api.github.com/users/vkurennov/gists{/gist_id}","starred_url":"https://api.github.com/users/vkurennov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkurennov/subscriptions","organizations_url":"https://api.github.com/users/vkurennov/orgs","repos_url":"https://api.github.com/users/vkurennov/repos","events_url":"https://api.github.com/users/vkurennov/events{/privacy}","received_events_url":"https://api.github.com/users/vkurennov/received_events","type":"User","site_admin":false},"body":"Ты верно догадался, что нужно проверить не только создание ответа, но и то, что он связан с нужным вопросом. Но сделать это можно красивее. Намекну: метод change в качестве первого аргумента может принимать не только класс, но и любой метод или ассоциацию объекта.","created_at":"2015-06-03T08:50:45Z","updated_at":"2015-06-03T08:50:45Z","html_url":"https://github.com/KramiDev/StackOverflow/pull/2#discussion_r31604229","pull_request_url":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/comments/31604229"},"html":{"href":"https://github.com/KramiDev/StackOverflow/pull/2#discussion_r31604229"},"pull_request":{"href":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/2","id":36769544,"html_url":"https://github.com/KramiDev/StackOverflow/pull/2","diff_url":"https://github.com/KramiDev/StackOverflow/pull/2.diff","patch_url":"https://github.com/KramiDev/StackOverflow/pull/2.patch","issue_url":"https://api.github.com/repos/KramiDev/StackOverflow/issues/2","number":2,"state":"open","locked":false,"title":"Task 4","user":{"login":"KramiDev","id":10125376,"avatar_url":"https://avatars.githubusercontent.com/u/10125376?v=3","gravatar_id":"","url":"https://api.github.com/users/KramiDev","html_url":"https://github.com/KramiDev","followers_url":"https://api.github.com/users/KramiDev/followers","following_url":"https://api.github.com/users/KramiDev/following{/other_user}","gists_url":"https://api.github.com/users/KramiDev/gists{/gist_id}","starred_url":"https://api.github.com/users/KramiDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KramiDev/subscriptions","organizations_url":"https://api.github.com/users/KramiDev/orgs","repos_url":"https://api.github.com/users/KramiDev/repos","events_url":"https://api.github.com/users/KramiDev/events{/privacy}","received_events_url":"https://api.github.com/users/KramiDev/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-02T20:18:55Z","updated_at":"2015-06-03T08:50:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aab9c0076b68547312c25778dbcec0d6db5e47e7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/2/commits","review_comments_url":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/2/comments","review_comment_url":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/KramiDev/StackOverflow/issues/2/comments","statuses_url":"https://api.github.com/repos/KramiDev/StackOverflow/statuses/2619161646791da492ed83f91540bb104e21e8f8","head":{"label":"KramiDev:task-4","ref":"task-4","sha":"2619161646791da492ed83f91540bb104e21e8f8","user":{"login":"KramiDev","id":10125376,"avatar_url":"https://avatars.githubusercontent.com/u/10125376?v=3","gravatar_id":"","url":"https://api.github.com/users/KramiDev","html_url":"https://github.com/KramiDev","followers_url":"https://api.github.com/users/KramiDev/followers","following_url":"https://api.github.com/users/KramiDev/following{/other_user}","gists_url":"https://api.github.com/users/KramiDev/gists{/gist_id}","starred_url":"https://api.github.com/users/KramiDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KramiDev/subscriptions","organizations_url":"https://api.github.com/users/KramiDev/orgs","repos_url":"https://api.github.com/users/KramiDev/repos","events_url":"https://api.github.com/users/KramiDev/events{/privacy}","received_events_url":"https://api.github.com/users/KramiDev/received_events","type":"User","site_admin":false},"repo":{"id":36554672,"name":"StackOverflow","full_name":"KramiDev/StackOverflow","owner":{"login":"KramiDev","id":10125376,"avatar_url":"https://avatars.githubusercontent.com/u/10125376?v=3","gravatar_id":"","url":"https://api.github.com/users/KramiDev","html_url":"https://github.com/KramiDev","followers_url":"https://api.github.com/users/KramiDev/followers","following_url":"https://api.github.com/users/KramiDev/following{/other_user}","gists_url":"https://api.github.com/users/KramiDev/gists{/gist_id}","starred_url":"https://api.github.com/users/KramiDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KramiDev/subscriptions","organizations_url":"https://api.github.com/users/KramiDev/orgs","repos_url":"https://api.github.com/users/KramiDev/repos","events_url":"https://api.github.com/users/KramiDev/events{/privacy}","received_events_url":"https://api.github.com/users/KramiDev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KramiDev/StackOverflow","description":"Тестовый проект для курса thinknetica.com","fork":false,"url":"https://api.github.com/repos/KramiDev/StackOverflow","forks_url":"https://api.github.com/repos/KramiDev/StackOverflow/forks","keys_url":"https://api.github.com/repos/KramiDev/StackOverflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KramiDev/StackOverflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KramiDev/StackOverflow/teams","hooks_url":"https://api.github.com/repos/KramiDev/StackOverflow/hooks","issue_events_url":"https://api.github.com/repos/KramiDev/StackOverflow/issues/events{/number}","events_url":"https://api.github.com/repos/KramiDev/StackOverflow/events","assignees_url":"https://api.github.com/repos/KramiDev/StackOverflow/assignees{/user}","branches_url":"https://api.github.com/repos/KramiDev/StackOverflow/branches{/branch}","tags_url":"https://api.github.com/repos/KramiDev/StackOverflow/tags","blobs_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KramiDev/StackOverflow/statuses/{sha}","languages_url":"https://api.github.com/repos/KramiDev/StackOverflow/languages","stargazers_url":"https://api.github.com/repos/KramiDev/StackOverflow/stargazers","contributors_url":"https://api.github.com/repos/KramiDev/StackOverflow/contributors","subscribers_url":"https://api.github.com/repos/KramiDev/StackOverflow/subscribers","subscription_url":"https://api.github.com/repos/KramiDev/StackOverflow/subscription","commits_url":"https://api.github.com/repos/KramiDev/StackOverflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/KramiDev/StackOverflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/KramiDev/StackOverflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/KramiDev/StackOverflow/contents/{+path}","compare_url":"https://api.github.com/repos/KramiDev/StackOverflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KramiDev/StackOverflow/merges","archive_url":"https://api.github.com/repos/KramiDev/StackOverflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KramiDev/StackOverflow/downloads","issues_url":"https://api.github.com/repos/KramiDev/StackOverflow/issues{/number}","pulls_url":"https://api.github.com/repos/KramiDev/StackOverflow/pulls{/number}","milestones_url":"https://api.github.com/repos/KramiDev/StackOverflow/milestones{/number}","notifications_url":"https://api.github.com/repos/KramiDev/StackOverflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KramiDev/StackOverflow/labels{/name}","releases_url":"https://api.github.com/repos/KramiDev/StackOverflow/releases{/id}","created_at":"2015-05-30T11:02:10Z","updated_at":"2015-05-30T11:10:41Z","pushed_at":"2015-06-02T20:18:56Z","git_url":"git://github.com/KramiDev/StackOverflow.git","ssh_url":"git@github.com:KramiDev/StackOverflow.git","clone_url":"https://github.com/KramiDev/StackOverflow.git","svn_url":"https://github.com/KramiDev/StackOverflow","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":"KramiDev:master","ref":"master","sha":"5d32c6f1293564a573c446b80a4d3e8b373962ff","user":{"login":"KramiDev","id":10125376,"avatar_url":"https://avatars.githubusercontent.com/u/10125376?v=3","gravatar_id":"","url":"https://api.github.com/users/KramiDev","html_url":"https://github.com/KramiDev","followers_url":"https://api.github.com/users/KramiDev/followers","following_url":"https://api.github.com/users/KramiDev/following{/other_user}","gists_url":"https://api.github.com/users/KramiDev/gists{/gist_id}","starred_url":"https://api.github.com/users/KramiDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KramiDev/subscriptions","organizations_url":"https://api.github.com/users/KramiDev/orgs","repos_url":"https://api.github.com/users/KramiDev/repos","events_url":"https://api.github.com/users/KramiDev/events{/privacy}","received_events_url":"https://api.github.com/users/KramiDev/received_events","type":"User","site_admin":false},"repo":{"id":36554672,"name":"StackOverflow","full_name":"KramiDev/StackOverflow","owner":{"login":"KramiDev","id":10125376,"avatar_url":"https://avatars.githubusercontent.com/u/10125376?v=3","gravatar_id":"","url":"https://api.github.com/users/KramiDev","html_url":"https://github.com/KramiDev","followers_url":"https://api.github.com/users/KramiDev/followers","following_url":"https://api.github.com/users/KramiDev/following{/other_user}","gists_url":"https://api.github.com/users/KramiDev/gists{/gist_id}","starred_url":"https://api.github.com/users/KramiDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KramiDev/subscriptions","organizations_url":"https://api.github.com/users/KramiDev/orgs","repos_url":"https://api.github.com/users/KramiDev/repos","events_url":"https://api.github.com/users/KramiDev/events{/privacy}","received_events_url":"https://api.github.com/users/KramiDev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KramiDev/StackOverflow","description":"Тестовый проект для курса thinknetica.com","fork":false,"url":"https://api.github.com/repos/KramiDev/StackOverflow","forks_url":"https://api.github.com/repos/KramiDev/StackOverflow/forks","keys_url":"https://api.github.com/repos/KramiDev/StackOverflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KramiDev/StackOverflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KramiDev/StackOverflow/teams","hooks_url":"https://api.github.com/repos/KramiDev/StackOverflow/hooks","issue_events_url":"https://api.github.com/repos/KramiDev/StackOverflow/issues/events{/number}","events_url":"https://api.github.com/repos/KramiDev/StackOverflow/events","assignees_url":"https://api.github.com/repos/KramiDev/StackOverflow/assignees{/user}","branches_url":"https://api.github.com/repos/KramiDev/StackOverflow/branches{/branch}","tags_url":"https://api.github.com/repos/KramiDev/StackOverflow/tags","blobs_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KramiDev/StackOverflow/statuses/{sha}","languages_url":"https://api.github.com/repos/KramiDev/StackOverflow/languages","stargazers_url":"https://api.github.com/repos/KramiDev/StackOverflow/stargazers","contributors_url":"https://api.github.com/repos/KramiDev/StackOverflow/contributors","subscribers_url":"https://api.github.com/repos/KramiDev/StackOverflow/subscribers","subscription_url":"https://api.github.com/repos/KramiDev/StackOverflow/subscription","commits_url":"https://api.github.com/repos/KramiDev/StackOverflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/KramiDev/StackOverflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/KramiDev/StackOverflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/KramiDev/StackOverflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/KramiDev/StackOverflow/contents/{+path}","compare_url":"https://api.github.com/repos/KramiDev/StackOverflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KramiDev/StackOverflow/merges","archive_url":"https://api.github.com/repos/KramiDev/StackOverflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KramiDev/StackOverflow/downloads","issues_url":"https://api.github.com/repos/KramiDev/StackOverflow/issues{/number}","pulls_url":"https://api.github.com/repos/KramiDev/StackOverflow/pulls{/number}","milestones_url":"https://api.github.com/repos/KramiDev/StackOverflow/milestones{/number}","notifications_url":"https://api.github.com/repos/KramiDev/StackOverflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KramiDev/StackOverflow/labels{/name}","releases_url":"https://api.github.com/repos/KramiDev/StackOverflow/releases{/id}","created_at":"2015-05-30T11:02:10Z","updated_at":"2015-05-30T11:10:41Z","pushed_at":"2015-06-02T20:18:56Z","git_url":"git://github.com/KramiDev/StackOverflow.git","ssh_url":"git@github.com:KramiDev/StackOverflow.git","clone_url":"https://github.com/KramiDev/StackOverflow.git","svn_url":"https://github.com/KramiDev/StackOverflow","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/KramiDev/StackOverflow/pulls/2"},"html":{"href":"https://github.com/KramiDev/StackOverflow/pull/2"},"issue":{"href":"https://api.github.com/repos/KramiDev/StackOverflow/issues/2"},"comments":{"href":"https://api.github.com/repos/KramiDev/StackOverflow/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/KramiDev/StackOverflow/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/KramiDev/StackOverflow/statuses/2619161646791da492ed83f91540bb104e21e8f8"}}}}