{"action":"created","comment":{"url":"https://api.github.com/repos/Maverick1211/chat-space/pulls/comments/93596968","pull_request_review_id":14127267,"id":93596968,"diff_hunk":"@@ -0,0 +1,90 @@\n+require 'rails_helper'\n+\n+describe MessagesController do\n+  describe \"when_user_signed_in\" do\n+    before :each do\n+      sign_in user\n+    end\n+    let(:group) { create(:group, users: [user]) }\n+    let(:message) { create(:message, user: user, group: group) }\n+    let(:user) { create(:user) }\n+    describe ' GET #index ' do\n+      it \"assigns the requested group to @group\" do\n+        get :index, group_id: group\n+        expect(assigns(:group)).to eq(group)\n+      end\n+\n+      it \"assigns the requested groups to @groups\" do\n+        groups = create_list(:group, 3, users: [user])\n+        get :index, group_id: groups.first\n+        expect(assigns(:groups)).to eq(groups)\n+      end\n+\n+      it \"assigns the requested users to @users\" do\n+        users = create_list(:user, 3, groups: [group])\n+        get :index, group_id: group\n+        expect(assigns(:users)).to eq([user] + users)\n+      end\n+\n+      it \"assigns the requested messages to @messages\" do\n+        messages = create_list(:message, 3, group: group, user: user)\n+        get :index, group_id: group\n+        expect(assigns(:messages)).to eq(messages)\n+      end\n+\n+      it \"assigns the requested message to @message\" do\n+        get :index, group_id: group\n+        expect(assigns(:message)).to be_a_new(Message)\n+      end\n+      \n+      it \"renders the :index template\" do\n+        get :index, group_id: group\n+        expect(response).to render_template :index\n+      end\n+    end\n+    \n+    describe ' POST #create ' do\n+      it \"assigns the requested message to @message\" do\n+        get :index, group_id: group\n+        expect(assigns(:message)).to be_a_new(Message)\n+      end\n+      context \"with valid attributes\" do\n+        it 'message was created succesufully' do\n+          expect{ post :create, group_id: group, message: attributes_for(:message) }.to change(Message, :count).by(1)\n+        end\n+\n+        it \"redirect_to the index\" do\n+          post :create, group_id: group, message: attributes_for(:message)\n+          expect(response).to redirect_to group_messages_path(group)\n+        end\n+\n+        it \"show flash[:notice] message\" do\n+          post :create, group_id: group, message: attributes_for(:message)\n+          expect(flash[:notice]).to eq ( \"you created message\" )\n+        end\n+      end\n+      context \"with invalid attributes\" do\n+        it 'message was created unsuccesufully' do","path":"spec/controllers/messages_controller_spec.rb","position":67,"original_position":67,"commit_id":"bddc4647773b365980d4f89276feb7a46e54c147","original_commit_id":"bddc4647773b365980d4f89276feb7a46e54c147","user":{"login":"snowhork","id":18437866,"avatar_url":"https://avatars.githubusercontent.com/u/18437866?v=3","gravatar_id":"","url":"https://api.github.com/users/snowhork","html_url":"https://github.com/snowhork","followers_url":"https://api.github.com/users/snowhork/followers","following_url":"https://api.github.com/users/snowhork/following{/other_user}","gists_url":"https://api.github.com/users/snowhork/gists{/gist_id}","starred_url":"https://api.github.com/users/snowhork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snowhork/subscriptions","organizations_url":"https://api.github.com/users/snowhork/orgs","repos_url":"https://api.github.com/users/snowhork/repos","events_url":"https://api.github.com/users/snowhork/events{/privacy}","received_events_url":"https://api.github.com/users/snowhork/received_events","type":"User","site_admin":false},"body":"L66の下に`let(:request) { post :create, group_id: group, message: attributes_for(:message ,body: nil) }\r\n\r\nって書いておいて、\r\n各テストの最初にrequestって書くと良いよ（上も同様に","created_at":"2016-12-22T10:15:25Z","updated_at":"2016-12-22T10:15:25Z","html_url":"https://github.com/Maverick1211/chat-space/pull/9#discussion_r93596968","pull_request_url":"https://api.github.com/repos/Maverick1211/chat-space/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/Maverick1211/chat-space/pulls/comments/93596968"},"html":{"href":"https://github.com/Maverick1211/chat-space/pull/9#discussion_r93596968"},"pull_request":{"href":"https://api.github.com/repos/Maverick1211/chat-space/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/Maverick1211/chat-space/pulls/9","id":98968988,"html_url":"https://github.com/Maverick1211/chat-space/pull/9","diff_url":"https://github.com/Maverick1211/chat-space/pull/9.diff","patch_url":"https://github.com/Maverick1211/chat-space/pull/9.patch","issue_url":"https://api.github.com/repos/Maverick1211/chat-space/issues/9","number":9,"state":"open","locked":false,"title":"Unit test","user":{"login":"Maverick1211","id":23258763,"avatar_url":"https://avatars.githubusercontent.com/u/23258763?v=3","gravatar_id":"","url":"https://api.github.com/users/Maverick1211","html_url":"https://github.com/Maverick1211","followers_url":"https://api.github.com/users/Maverick1211/followers","following_url":"https://api.github.com/users/Maverick1211/following{/other_user}","gists_url":"https://api.github.com/users/Maverick1211/gists{/gist_id}","starred_url":"https://api.github.com/users/Maverick1211/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maverick1211/subscriptions","organizations_url":"https://api.github.com/users/Maverick1211/orgs","repos_url":"https://api.github.com/users/Maverick1211/repos","events_url":"https://api.github.com/users/Maverick1211/events{/privacy}","received_events_url":"https://api.github.com/users/Maverick1211/received_events","type":"User","site_admin":false},"body":"# what\r\nテストの実装\r\n# why\r\nバグが起こったら、顧客の信頼性を失うから\r\n# how\r\n・messages_controller_spec.rb\r\n・message_spec.rb\r\n・rails_helper.rb\r\n・groups.rb\r\n・messages.rb\r\n・users.rb","created_at":"2016-12-21T17:01:20Z","updated_at":"2016-12-22T10:15:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d4131599e3b0bf94965e39a8f5b233c4cc103e1b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Maverick1211/chat-space/pulls/9/commits","review_comments_url":"https://api.github.com/repos/Maverick1211/chat-space/pulls/9/comments","review_comment_url":"https://api.github.com/repos/Maverick1211/chat-space/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Maverick1211/chat-space/issues/9/comments","statuses_url":"https://api.github.com/repos/Maverick1211/chat-space/statuses/bddc4647773b365980d4f89276feb7a46e54c147","head":{"label":"Maverick1211:Unit-Test","ref":"Unit-Test","sha":"bddc4647773b365980d4f89276feb7a46e54c147","user":{"login":"Maverick1211","id":23258763,"avatar_url":"https://avatars.githubusercontent.com/u/23258763?v=3","gravatar_id":"","url":"https://api.github.com/users/Maverick1211","html_url":"https://github.com/Maverick1211","followers_url":"https://api.github.com/users/Maverick1211/followers","following_url":"https://api.github.com/users/Maverick1211/following{/other_user}","gists_url":"https://api.github.com/users/Maverick1211/gists{/gist_id}","starred_url":"https://api.github.com/users/Maverick1211/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maverick1211/subscriptions","organizations_url":"https://api.github.com/users/Maverick1211/orgs","repos_url":"https://api.github.com/users/Maverick1211/repos","events_url":"https://api.github.com/users/Maverick1211/events{/privacy}","received_events_url":"https://api.github.com/users/Maverick1211/received_events","type":"User","site_admin":false},"repo":{"id":75308078,"name":"chat-space","full_name":"Maverick1211/chat-space","owner":{"login":"Maverick1211","id":23258763,"avatar_url":"https://avatars.githubusercontent.com/u/23258763?v=3","gravatar_id":"","url":"https://api.github.com/users/Maverick1211","html_url":"https://github.com/Maverick1211","followers_url":"https://api.github.com/users/Maverick1211/followers","following_url":"https://api.github.com/users/Maverick1211/following{/other_user}","gists_url":"https://api.github.com/users/Maverick1211/gists{/gist_id}","starred_url":"https://api.github.com/users/Maverick1211/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maverick1211/subscriptions","organizations_url":"https://api.github.com/users/Maverick1211/orgs","repos_url":"https://api.github.com/users/Maverick1211/repos","events_url":"https://api.github.com/users/Maverick1211/events{/privacy}","received_events_url":"https://api.github.com/users/Maverick1211/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Maverick1211/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/Maverick1211/chat-space","forks_url":"https://api.github.com/repos/Maverick1211/chat-space/forks","keys_url":"https://api.github.com/repos/Maverick1211/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Maverick1211/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Maverick1211/chat-space/teams","hooks_url":"https://api.github.com/repos/Maverick1211/chat-space/hooks","issue_events_url":"https://api.github.com/repos/Maverick1211/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/Maverick1211/chat-space/events","assignees_url":"https://api.github.com/repos/Maverick1211/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/Maverick1211/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/Maverick1211/chat-space/tags","blobs_url":"https://api.github.com/repos/Maverick1211/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Maverick1211/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Maverick1211/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/Maverick1211/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Maverick1211/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/Maverick1211/chat-space/languages","stargazers_url":"https://api.github.com/repos/Maverick1211/chat-space/stargazers","contributors_url":"https://api.github.com/repos/Maverick1211/chat-space/contributors","subscribers_url":"https://api.github.com/repos/Maverick1211/chat-space/subscribers","subscription_url":"https://api.github.com/repos/Maverick1211/chat-space/subscription","commits_url":"https://api.github.com/repos/Maverick1211/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/Maverick1211/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/Maverick1211/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/Maverick1211/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/Maverick1211/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/Maverick1211/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Maverick1211/chat-space/merges","archive_url":"https://api.github.com/repos/Maverick1211/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Maverick1211/chat-space/downloads","issues_url":"https://api.github.com/repos/Maverick1211/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/Maverick1211/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/Maverick1211/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/Maverick1211/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Maverick1211/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/Maverick1211/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/Maverick1211/chat-space/deployments","created_at":"2016-12-01T15:53:20Z","updated_at":"2016-12-01T15:53:28Z","pushed_at":"2016-12-22T10:11:39Z","git_url":"git://github.com/Maverick1211/chat-space.git","ssh_url":"git@github.com:Maverick1211/chat-space.git","clone_url":"https://github.com/Maverick1211/chat-space.git","svn_url":"https://github.com/Maverick1211/chat-space","homepage":null,"size":121,"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":"Maverick1211:master","ref":"master","sha":"b7e83f3253a8376464a023ebe1e45af19f523fde","user":{"login":"Maverick1211","id":23258763,"avatar_url":"https://avatars.githubusercontent.com/u/23258763?v=3","gravatar_id":"","url":"https://api.github.com/users/Maverick1211","html_url":"https://github.com/Maverick1211","followers_url":"https://api.github.com/users/Maverick1211/followers","following_url":"https://api.github.com/users/Maverick1211/following{/other_user}","gists_url":"https://api.github.com/users/Maverick1211/gists{/gist_id}","starred_url":"https://api.github.com/users/Maverick1211/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maverick1211/subscriptions","organizations_url":"https://api.github.com/users/Maverick1211/orgs","repos_url":"https://api.github.com/users/Maverick1211/repos","events_url":"https://api.github.com/users/Maverick1211/events{/privacy}","received_events_url":"https://api.github.com/users/Maverick1211/received_events","type":"User","site_admin":false},"repo":{"id":75308078,"name":"chat-space","full_name":"Maverick1211/chat-space","owner":{"login":"Maverick1211","id":23258763,"avatar_url":"https://avatars.githubusercontent.com/u/23258763?v=3","gravatar_id":"","url":"https://api.github.com/users/Maverick1211","html_url":"https://github.com/Maverick1211","followers_url":"https://api.github.com/users/Maverick1211/followers","following_url":"https://api.github.com/users/Maverick1211/following{/other_user}","gists_url":"https://api.github.com/users/Maverick1211/gists{/gist_id}","starred_url":"https://api.github.com/users/Maverick1211/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maverick1211/subscriptions","organizations_url":"https://api.github.com/users/Maverick1211/orgs","repos_url":"https://api.github.com/users/Maverick1211/repos","events_url":"https://api.github.com/users/Maverick1211/events{/privacy}","received_events_url":"https://api.github.com/users/Maverick1211/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Maverick1211/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/Maverick1211/chat-space","forks_url":"https://api.github.com/repos/Maverick1211/chat-space/forks","keys_url":"https://api.github.com/repos/Maverick1211/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Maverick1211/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Maverick1211/chat-space/teams","hooks_url":"https://api.github.com/repos/Maverick1211/chat-space/hooks","issue_events_url":"https://api.github.com/repos/Maverick1211/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/Maverick1211/chat-space/events","assignees_url":"https://api.github.com/repos/Maverick1211/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/Maverick1211/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/Maverick1211/chat-space/tags","blobs_url":"https://api.github.com/repos/Maverick1211/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Maverick1211/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Maverick1211/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/Maverick1211/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Maverick1211/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/Maverick1211/chat-space/languages","stargazers_url":"https://api.github.com/repos/Maverick1211/chat-space/stargazers","contributors_url":"https://api.github.com/repos/Maverick1211/chat-space/contributors","subscribers_url":"https://api.github.com/repos/Maverick1211/chat-space/subscribers","subscription_url":"https://api.github.com/repos/Maverick1211/chat-space/subscription","commits_url":"https://api.github.com/repos/Maverick1211/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/Maverick1211/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/Maverick1211/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/Maverick1211/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/Maverick1211/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/Maverick1211/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Maverick1211/chat-space/merges","archive_url":"https://api.github.com/repos/Maverick1211/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Maverick1211/chat-space/downloads","issues_url":"https://api.github.com/repos/Maverick1211/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/Maverick1211/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/Maverick1211/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/Maverick1211/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Maverick1211/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/Maverick1211/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/Maverick1211/chat-space/deployments","created_at":"2016-12-01T15:53:20Z","updated_at":"2016-12-01T15:53:28Z","pushed_at":"2016-12-22T10:11:39Z","git_url":"git://github.com/Maverick1211/chat-space.git","ssh_url":"git@github.com:Maverick1211/chat-space.git","clone_url":"https://github.com/Maverick1211/chat-space.git","svn_url":"https://github.com/Maverick1211/chat-space","homepage":null,"size":121,"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/Maverick1211/chat-space/pulls/9"},"html":{"href":"https://github.com/Maverick1211/chat-space/pull/9"},"issue":{"href":"https://api.github.com/repos/Maverick1211/chat-space/issues/9"},"comments":{"href":"https://api.github.com/repos/Maverick1211/chat-space/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/Maverick1211/chat-space/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/Maverick1211/chat-space/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Maverick1211/chat-space/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/Maverick1211/chat-space/statuses/bddc4647773b365980d4f89276feb7a46e54c147"}}}}
{"actor":{"display_login":"snowhork"}}