{"action":"created","comment":{"url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/comments/33410408","id":33410408,"diff_hunk":"@@ -0,0 +1,46 @@\n+require 'rails_helper'\n+\n+RSpec.describe AnswersController, type: :controller do\n+  let!(:f_question) { create(:question) }\n+  let!(:f_answer) { create(:answer, question: f_question) }\n+\n+  describe 'GET #new' do\n+    before { get :new, question_id: f_question }\n+\n+    it 'creates a new Answer object' do\n+      expect(assigns(:answer)).to be_a_new(Answer)\n+    end\n+\n+    it 'assigns to answer.question_id correct question_id' do\n+      expect(assigns(:answer).question_id).to eq f_question.id\n+    end\n+\n+    it 'renders a new template' do\n+      expect(response).to render_template :new\n+    end\n+  end\n+\n+  describe 'POST #create' do\n+    context 'with valid object' do\n+      it 'saves new answer in database' do\n+        expect { post :create, answer: attributes_for(:answer), question_id: f_question }.to change(Answer, :count).by(1)","path":"spec/controllers/answers_controller_spec.rb","position":26,"original_position":26,"commit_id":"027d540dbe84181a9c7bb6d76935e3a17f8eac96","original_commit_id":"027d540dbe84181a9c7bb6d76935e3a17f8eac96","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-27T07:06:18Z","updated_at":"2015-06-27T07:06:18Z","html_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone/pull/2#discussion_r33410408","pull_request_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/comments/33410408"},"html":{"href":"https://github.com/AleksandrKudashkin/stack-overflow-clone/pull/2#discussion_r33410408"},"pull_request":{"href":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/2","id":38704752,"html_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone/pull/2","diff_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone/pull/2.diff","patch_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone/pull/2.patch","issue_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues/2","number":2,"state":"open","locked":false,"title":"Lesson4","user":{"login":"AleksandrKudashkin","id":11471420,"avatar_url":"https://avatars.githubusercontent.com/u/11471420?v=3","gravatar_id":"","url":"https://api.github.com/users/AleksandrKudashkin","html_url":"https://github.com/AleksandrKudashkin","followers_url":"https://api.github.com/users/AleksandrKudashkin/followers","following_url":"https://api.github.com/users/AleksandrKudashkin/following{/other_user}","gists_url":"https://api.github.com/users/AleksandrKudashkin/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksandrKudashkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksandrKudashkin/subscriptions","organizations_url":"https://api.github.com/users/AleksandrKudashkin/orgs","repos_url":"https://api.github.com/users/AleksandrKudashkin/repos","events_url":"https://api.github.com/users/AleksandrKudashkin/events{/privacy}","received_events_url":"https://api.github.com/users/AleksandrKudashkin/received_events","type":"User","site_admin":false},"body":"Как делал:\r\n- Сначала по примеру видеоурока сделал через тесты QuestionsController (для истории \"Пользователь может создавать вопросы\")\r\n- Потом не без труда через тесты сделал AnswersController  (для истории \"Пользователь может создавать ответы\")\r\n- Сделал вьюхи с формами и ссылками\r\n- Подключил boostrap и немного причесал вьюхи\r\n\r\nТрудности:\r\n- По ошибке сделал пару коммитов в мастер, вместо ветки, пришлось потом делать git push --force. Думаю, не очень хорошая идея, но пока не понял, как поправить это. Локально то я rebase сделал, а на гитхабе как сделать - непонятно.\r\n- На освоение bootstrap нужно ещё время, но штука эта нравится","created_at":"2015-06-27T06:08:45Z","updated_at":"2015-06-27T07:06:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f3dd02b05a8d98802674289d1ec8003e9f8a8137","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/2/commits","review_comments_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/2/comments","review_comment_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues/2/comments","statuses_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/statuses/027d540dbe84181a9c7bb6d76935e3a17f8eac96","head":{"label":"AleksandrKudashkin:Lesson4","ref":"Lesson4","sha":"027d540dbe84181a9c7bb6d76935e3a17f8eac96","user":{"login":"AleksandrKudashkin","id":11471420,"avatar_url":"https://avatars.githubusercontent.com/u/11471420?v=3","gravatar_id":"","url":"https://api.github.com/users/AleksandrKudashkin","html_url":"https://github.com/AleksandrKudashkin","followers_url":"https://api.github.com/users/AleksandrKudashkin/followers","following_url":"https://api.github.com/users/AleksandrKudashkin/following{/other_user}","gists_url":"https://api.github.com/users/AleksandrKudashkin/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksandrKudashkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksandrKudashkin/subscriptions","organizations_url":"https://api.github.com/users/AleksandrKudashkin/orgs","repos_url":"https://api.github.com/users/AleksandrKudashkin/repos","events_url":"https://api.github.com/users/AleksandrKudashkin/events{/privacy}","received_events_url":"https://api.github.com/users/AleksandrKudashkin/received_events","type":"User","site_admin":false},"repo":{"id":37356411,"name":"stack-overflow-clone","full_name":"AleksandrKudashkin/stack-overflow-clone","owner":{"login":"AleksandrKudashkin","id":11471420,"avatar_url":"https://avatars.githubusercontent.com/u/11471420?v=3","gravatar_id":"","url":"https://api.github.com/users/AleksandrKudashkin","html_url":"https://github.com/AleksandrKudashkin","followers_url":"https://api.github.com/users/AleksandrKudashkin/followers","following_url":"https://api.github.com/users/AleksandrKudashkin/following{/other_user}","gists_url":"https://api.github.com/users/AleksandrKudashkin/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksandrKudashkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksandrKudashkin/subscriptions","organizations_url":"https://api.github.com/users/AleksandrKudashkin/orgs","repos_url":"https://api.github.com/users/AleksandrKudashkin/repos","events_url":"https://api.github.com/users/AleksandrKudashkin/events{/privacy}","received_events_url":"https://api.github.com/users/AleksandrKudashkin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone","description":"Study Project in Thinknetica","fork":false,"url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone","forks_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/forks","keys_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/teams","hooks_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/hooks","issue_events_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues/events{/number}","events_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/events","assignees_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/assignees{/user}","branches_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/branches{/branch}","tags_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/tags","blobs_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/refs{/sha}","trees_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/statuses/{sha}","languages_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/languages","stargazers_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/stargazers","contributors_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/contributors","subscribers_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/subscribers","subscription_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/subscription","commits_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/commits{/sha}","git_commits_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/commits{/sha}","comments_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/comments{/number}","issue_comment_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues/comments{/number}","contents_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/contents/{+path}","compare_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/merges","archive_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/downloads","issues_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues{/number}","pulls_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls{/number}","milestones_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/milestones{/number}","notifications_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/labels{/name}","releases_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/releases{/id}","created_at":"2015-06-13T03:38:05Z","updated_at":"2015-06-13T03:39:20Z","pushed_at":"2015-06-27T06:08:45Z","git_url":"git://github.com/AleksandrKudashkin/stack-overflow-clone.git","ssh_url":"git@github.com:AleksandrKudashkin/stack-overflow-clone.git","clone_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone.git","svn_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone","homepage":null,"size":196,"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":"AleksandrKudashkin:master","ref":"master","sha":"364cace51e48cec98145a1bb652cb4cff421b154","user":{"login":"AleksandrKudashkin","id":11471420,"avatar_url":"https://avatars.githubusercontent.com/u/11471420?v=3","gravatar_id":"","url":"https://api.github.com/users/AleksandrKudashkin","html_url":"https://github.com/AleksandrKudashkin","followers_url":"https://api.github.com/users/AleksandrKudashkin/followers","following_url":"https://api.github.com/users/AleksandrKudashkin/following{/other_user}","gists_url":"https://api.github.com/users/AleksandrKudashkin/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksandrKudashkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksandrKudashkin/subscriptions","organizations_url":"https://api.github.com/users/AleksandrKudashkin/orgs","repos_url":"https://api.github.com/users/AleksandrKudashkin/repos","events_url":"https://api.github.com/users/AleksandrKudashkin/events{/privacy}","received_events_url":"https://api.github.com/users/AleksandrKudashkin/received_events","type":"User","site_admin":false},"repo":{"id":37356411,"name":"stack-overflow-clone","full_name":"AleksandrKudashkin/stack-overflow-clone","owner":{"login":"AleksandrKudashkin","id":11471420,"avatar_url":"https://avatars.githubusercontent.com/u/11471420?v=3","gravatar_id":"","url":"https://api.github.com/users/AleksandrKudashkin","html_url":"https://github.com/AleksandrKudashkin","followers_url":"https://api.github.com/users/AleksandrKudashkin/followers","following_url":"https://api.github.com/users/AleksandrKudashkin/following{/other_user}","gists_url":"https://api.github.com/users/AleksandrKudashkin/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksandrKudashkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksandrKudashkin/subscriptions","organizations_url":"https://api.github.com/users/AleksandrKudashkin/orgs","repos_url":"https://api.github.com/users/AleksandrKudashkin/repos","events_url":"https://api.github.com/users/AleksandrKudashkin/events{/privacy}","received_events_url":"https://api.github.com/users/AleksandrKudashkin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone","description":"Study Project in Thinknetica","fork":false,"url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone","forks_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/forks","keys_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/teams","hooks_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/hooks","issue_events_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues/events{/number}","events_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/events","assignees_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/assignees{/user}","branches_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/branches{/branch}","tags_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/tags","blobs_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/refs{/sha}","trees_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/statuses/{sha}","languages_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/languages","stargazers_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/stargazers","contributors_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/contributors","subscribers_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/subscribers","subscription_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/subscription","commits_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/commits{/sha}","git_commits_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/git/commits{/sha}","comments_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/comments{/number}","issue_comment_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues/comments{/number}","contents_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/contents/{+path}","compare_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/merges","archive_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/downloads","issues_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues{/number}","pulls_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls{/number}","milestones_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/milestones{/number}","notifications_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/labels{/name}","releases_url":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/releases{/id}","created_at":"2015-06-13T03:38:05Z","updated_at":"2015-06-13T03:39:20Z","pushed_at":"2015-06-27T06:08:45Z","git_url":"git://github.com/AleksandrKudashkin/stack-overflow-clone.git","ssh_url":"git@github.com:AleksandrKudashkin/stack-overflow-clone.git","clone_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone.git","svn_url":"https://github.com/AleksandrKudashkin/stack-overflow-clone","homepage":null,"size":196,"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/AleksandrKudashkin/stack-overflow-clone/pulls/2"},"html":{"href":"https://github.com/AleksandrKudashkin/stack-overflow-clone/pull/2"},"issue":{"href":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues/2"},"comments":{"href":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/AleksandrKudashkin/stack-overflow-clone/statuses/027d540dbe84181a9c7bb6d76935e3a17f8eac96"}}}}