{"action":"created","comment":{"url":"https://api.github.com/repos/otofu-square/awesome_events/pulls/comments/66289245","id":66289245,"diff_hunk":"@@ -1,5 +1,83 @@\n require 'rails_helper'\n \n RSpec.describe EventsController, type: :controller do\n+  before do\n+    @user = User.create(\n+      provider: 'twitter',\n+      uid: '12345',\n+      nickname: 'nickname_test',\n+      image_url: 'image.jpg'\n+    )\n+    session[:user_id] = @user.id\n+  end\n \n+  describe 'GET /events/new' do\n+    before do\n+      get :new\n+    end\n+\n+    it 'ステータスコードが200であること' do\n+      expect(response.status).to eq 200\n+    end\n+\n+    it 'ビューとして new.html.erb が呼ばれること' do\n+      expect(response).to render_template 'new'\n+    end\n+\n+    it '@event に空イベントが格納されていること' do\n+      expect(assigns(:event)).to be_a_new(Event)\n+    end\n+  end\n+\n+  describe 'POST /events/' do\n+    before do\n+      @params = {\n+        event: {\n+          name:       'test.name',\n+          place:      'test.place',\n+          start_time: Time.local(2015, 1),\n+          end_time:   Time.local(2016, 1),\n+          content:    'test.content'\n+        }\n+      }\n+    end\n+\n+    context '登録成功するとき' do\n+      before do\n+        post :create, @params\n+      end\n+\n+      it '/event/:作成したイベントID にリダイレクトされること' do\n+        expect(response).to redirect_to assigns(:event)\n+      end\n+\n+      it 'フォーム送信されたデータと、DBに登録されたデータが一致すること' do\n+        columns = @params[:event].keys\n+        expect(assigns(:event).attributes.symbolize_keys.slice(*columns)).to eq @params[:event]\n+      end\n+\n+      it 'flash[:notice] に「作成しました。」という文字列が格納されていること' do\n+        expect(flash[:notice]).to eq '作成しました。'\n+      end\n+    end\n+\n+    context '登録失敗するとき' do","path":"spec/controllers/events_controller_spec.rb","position":null,"original_position":64,"commit_id":"2e6a5c93899751d7a5f1e5e84d3f260e5c290c8d","original_commit_id":"9577086c5ee0c8a5887d308caa2d69941e980a2a","user":{"login":"otofu-square","id":10118235,"avatar_url":"https://avatars.githubusercontent.com/u/10118235?v=3","gravatar_id":"","url":"https://api.github.com/users/otofu-square","html_url":"https://github.com/otofu-square","followers_url":"https://api.github.com/users/otofu-square/followers","following_url":"https://api.github.com/users/otofu-square/following{/other_user}","gists_url":"https://api.github.com/users/otofu-square/gists{/gist_id}","starred_url":"https://api.github.com/users/otofu-square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otofu-square/subscriptions","organizations_url":"https://api.github.com/users/otofu-square/orgs","repos_url":"https://api.github.com/users/otofu-square/repos","events_url":"https://api.github.com/users/otofu-square/events{/privacy}","received_events_url":"https://api.github.com/users/otofu-square/received_events","type":"User","site_admin":false},"body":"contextを追記して、どのような場合に成功/失敗するかを明記しました！\r\n\r\n2e6a5c9","created_at":"2016-06-08T16:24:04Z","updated_at":"2016-06-08T16:24:04Z","html_url":"https://github.com/otofu-square/awesome_events/pull/14#discussion_r66289245","pull_request_url":"https://api.github.com/repos/otofu-square/awesome_events/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/otofu-square/awesome_events/pulls/comments/66289245"},"html":{"href":"https://github.com/otofu-square/awesome_events/pull/14#discussion_r66289245"},"pull_request":{"href":"https://api.github.com/repos/otofu-square/awesome_events/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/otofu-square/awesome_events/pulls/14","id":72283460,"html_url":"https://github.com/otofu-square/awesome_events/pull/14","diff_url":"https://github.com/otofu-square/awesome_events/pull/14.diff","patch_url":"https://github.com/otofu-square/awesome_events/pull/14.patch","issue_url":"https://api.github.com/repos/otofu-square/awesome_events/issues/14","number":14,"state":"open","locked":false,"title":"[WIP]イベント登録フォームの実装","user":{"login":"otofu-square","id":10118235,"avatar_url":"https://avatars.githubusercontent.com/u/10118235?v=3","gravatar_id":"","url":"https://api.github.com/users/otofu-square","html_url":"https://github.com/otofu-square","followers_url":"https://api.github.com/users/otofu-square/followers","following_url":"https://api.github.com/users/otofu-square/following{/other_user}","gists_url":"https://api.github.com/users/otofu-square/gists{/gist_id}","starred_url":"https://api.github.com/users/otofu-square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otofu-square/subscriptions","organizations_url":"https://api.github.com/users/otofu-square/orgs","repos_url":"https://api.github.com/users/otofu-square/repos","events_url":"https://api.github.com/users/otofu-square/events{/privacy}","received_events_url":"https://api.github.com/users/otofu-square/received_events","type":"User","site_admin":false},"body":"### PRの目的\r\n\r\nイベントの新規作成フォームを実装します。\r\n\r\n### 背景\r\n\r\n今までWIPでPRを上げずに作業していた内容が大きく間違っていたため、再度やり直します。\r\n今回はきちんとWIPでPRを出し、作業ログを残しながら作業します。\r\n\r\n### Todo\r\n\r\n- [x] トップページにイベント新規作成画面へのリンクを追加する\r\n- [x] Userモデルにhas_many関係としてEventモデルを設定\r\n- [x] Eventコントローラの `new` アクションの実装    \r\n  - [x] イベント新規作成へのルーティング `GET /event/new` に対するアクション `#new` のテストを書く\r\n    - [x] ステータスコードが200であること\r\n    - [x] ビューとして new.html.erb が呼ばれること\r\n    - [x] `@event` に空イベントが格納されていること\r\n  - [x] 各テスト項目に対して機能を実装する\r\n- [x] Eventコントローラの `create` アクションの実装    \r\n  - [x] イベント新規作成へのルーティング `POST /event/` に対するアクション `#create` のテストを書く\r\n  - 登録成功時\r\n    - [x] `/event/:作成したイベントID` にリダイレクトされること\r\n    - [x] 登録したデータと、登録後取得できる値が等しいこと\r\n    - [x] `flash[:notice]` に `作成しました` という文字列が格納されていること\r\n  - 登録失敗時\r\n    - [x] ステータスコードが200であること\r\n    - [x] ビューとして new.html.erb が呼ばれること\r\n    - [x] エラーが発生した際に、インスタンス変数にエラーが格納されていること\r\n  - [x] 各テスト項目に対して機能を実装 \r\n\r\n### テスト以外の確認項目\r\n\r\n- [x] イベント登録後のshowテンプレートに「作成しました。」と表示されること。\r\n\r\n<img width=\"1226\" alt=\"2016-06-08 15 38 25\" src=\"https://cloud.githubusercontent.com/assets/10118235/15885048/5619d250-2d8f-11e6-878a-49884efbce6c.png\">\r\n \r\n- [x] 登録失敗時に呼び出されるnewテンプレートにエラー内容が表示されていること\r\n\r\n<img width=\"1209\" alt=\"2016-06-08 15 37 52\" src=\"https://cloud.githubusercontent.com/assets/10118235/15885045/53d4f6d2-2d8f-11e6-9f47-06058aacf796.png\">\r\n\r\n","created_at":"2016-06-02T03:09:51Z","updated_at":"2016-06-08T16:24:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c08a711994802c7db87e442148ee97db0bb3fff","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/otofu-square/awesome_events/pulls/14/commits","review_comments_url":"https://api.github.com/repos/otofu-square/awesome_events/pulls/14/comments","review_comment_url":"https://api.github.com/repos/otofu-square/awesome_events/pulls/comments{/number}","comments_url":"https://api.github.com/repos/otofu-square/awesome_events/issues/14/comments","statuses_url":"https://api.github.com/repos/otofu-square/awesome_events/statuses/2e6a5c93899751d7a5f1e5e84d3f260e5c290c8d","head":{"label":"otofu-square:create-event-form","ref":"create-event-form","sha":"2e6a5c93899751d7a5f1e5e84d3f260e5c290c8d","user":{"login":"otofu-square","id":10118235,"avatar_url":"https://avatars.githubusercontent.com/u/10118235?v=3","gravatar_id":"","url":"https://api.github.com/users/otofu-square","html_url":"https://github.com/otofu-square","followers_url":"https://api.github.com/users/otofu-square/followers","following_url":"https://api.github.com/users/otofu-square/following{/other_user}","gists_url":"https://api.github.com/users/otofu-square/gists{/gist_id}","starred_url":"https://api.github.com/users/otofu-square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otofu-square/subscriptions","organizations_url":"https://api.github.com/users/otofu-square/orgs","repos_url":"https://api.github.com/users/otofu-square/repos","events_url":"https://api.github.com/users/otofu-square/events{/privacy}","received_events_url":"https://api.github.com/users/otofu-square/received_events","type":"User","site_admin":false},"repo":{"id":59535238,"name":"awesome_events","full_name":"otofu-square/awesome_events","owner":{"login":"otofu-square","id":10118235,"avatar_url":"https://avatars.githubusercontent.com/u/10118235?v=3","gravatar_id":"","url":"https://api.github.com/users/otofu-square","html_url":"https://github.com/otofu-square","followers_url":"https://api.github.com/users/otofu-square/followers","following_url":"https://api.github.com/users/otofu-square/following{/other_user}","gists_url":"https://api.github.com/users/otofu-square/gists{/gist_id}","starred_url":"https://api.github.com/users/otofu-square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otofu-square/subscriptions","organizations_url":"https://api.github.com/users/otofu-square/orgs","repos_url":"https://api.github.com/users/otofu-square/repos","events_url":"https://api.github.com/users/otofu-square/events{/privacy}","received_events_url":"https://api.github.com/users/otofu-square/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/otofu-square/awesome_events","description":"","fork":false,"url":"https://api.github.com/repos/otofu-square/awesome_events","forks_url":"https://api.github.com/repos/otofu-square/awesome_events/forks","keys_url":"https://api.github.com/repos/otofu-square/awesome_events/keys{/key_id}","collaborators_url":"https://api.github.com/repos/otofu-square/awesome_events/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/otofu-square/awesome_events/teams","hooks_url":"https://api.github.com/repos/otofu-square/awesome_events/hooks","issue_events_url":"https://api.github.com/repos/otofu-square/awesome_events/issues/events{/number}","events_url":"https://api.github.com/repos/otofu-square/awesome_events/events","assignees_url":"https://api.github.com/repos/otofu-square/awesome_events/assignees{/user}","branches_url":"https://api.github.com/repos/otofu-square/awesome_events/branches{/branch}","tags_url":"https://api.github.com/repos/otofu-square/awesome_events/tags","blobs_url":"https://api.github.com/repos/otofu-square/awesome_events/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/otofu-square/awesome_events/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/otofu-square/awesome_events/git/refs{/sha}","trees_url":"https://api.github.com/repos/otofu-square/awesome_events/git/trees{/sha}","statuses_url":"https://api.github.com/repos/otofu-square/awesome_events/statuses/{sha}","languages_url":"https://api.github.com/repos/otofu-square/awesome_events/languages","stargazers_url":"https://api.github.com/repos/otofu-square/awesome_events/stargazers","contributors_url":"https://api.github.com/repos/otofu-square/awesome_events/contributors","subscribers_url":"https://api.github.com/repos/otofu-square/awesome_events/subscribers","subscription_url":"https://api.github.com/repos/otofu-square/awesome_events/subscription","commits_url":"https://api.github.com/repos/otofu-square/awesome_events/commits{/sha}","git_commits_url":"https://api.github.com/repos/otofu-square/awesome_events/git/commits{/sha}","comments_url":"https://api.github.com/repos/otofu-square/awesome_events/comments{/number}","issue_comment_url":"https://api.github.com/repos/otofu-square/awesome_events/issues/comments{/number}","contents_url":"https://api.github.com/repos/otofu-square/awesome_events/contents/{+path}","compare_url":"https://api.github.com/repos/otofu-square/awesome_events/compare/{base}...{head}","merges_url":"https://api.github.com/repos/otofu-square/awesome_events/merges","archive_url":"https://api.github.com/repos/otofu-square/awesome_events/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/otofu-square/awesome_events/downloads","issues_url":"https://api.github.com/repos/otofu-square/awesome_events/issues{/number}","pulls_url":"https://api.github.com/repos/otofu-square/awesome_events/pulls{/number}","milestones_url":"https://api.github.com/repos/otofu-square/awesome_events/milestones{/number}","notifications_url":"https://api.github.com/repos/otofu-square/awesome_events/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/otofu-square/awesome_events/labels{/name}","releases_url":"https://api.github.com/repos/otofu-square/awesome_events/releases{/id}","deployments_url":"https://api.github.com/repos/otofu-square/awesome_events/deployments","created_at":"2016-05-24T02:51:04Z","updated_at":"2016-05-25T02:10:47Z","pushed_at":"2016-06-08T16:19:27Z","git_url":"git://github.com/otofu-square/awesome_events.git","ssh_url":"git@github.com:otofu-square/awesome_events.git","clone_url":"https://github.com/otofu-square/awesome_events.git","svn_url":"https://github.com/otofu-square/awesome_events","homepage":null,"size":122,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"base":{"label":"otofu-square:master","ref":"master","sha":"a412bf349a4613fb210eb9f07ebe6e93f78e3dd8","user":{"login":"otofu-square","id":10118235,"avatar_url":"https://avatars.githubusercontent.com/u/10118235?v=3","gravatar_id":"","url":"https://api.github.com/users/otofu-square","html_url":"https://github.com/otofu-square","followers_url":"https://api.github.com/users/otofu-square/followers","following_url":"https://api.github.com/users/otofu-square/following{/other_user}","gists_url":"https://api.github.com/users/otofu-square/gists{/gist_id}","starred_url":"https://api.github.com/users/otofu-square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otofu-square/subscriptions","organizations_url":"https://api.github.com/users/otofu-square/orgs","repos_url":"https://api.github.com/users/otofu-square/repos","events_url":"https://api.github.com/users/otofu-square/events{/privacy}","received_events_url":"https://api.github.com/users/otofu-square/received_events","type":"User","site_admin":false},"repo":{"id":59535238,"name":"awesome_events","full_name":"otofu-square/awesome_events","owner":{"login":"otofu-square","id":10118235,"avatar_url":"https://avatars.githubusercontent.com/u/10118235?v=3","gravatar_id":"","url":"https://api.github.com/users/otofu-square","html_url":"https://github.com/otofu-square","followers_url":"https://api.github.com/users/otofu-square/followers","following_url":"https://api.github.com/users/otofu-square/following{/other_user}","gists_url":"https://api.github.com/users/otofu-square/gists{/gist_id}","starred_url":"https://api.github.com/users/otofu-square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otofu-square/subscriptions","organizations_url":"https://api.github.com/users/otofu-square/orgs","repos_url":"https://api.github.com/users/otofu-square/repos","events_url":"https://api.github.com/users/otofu-square/events{/privacy}","received_events_url":"https://api.github.com/users/otofu-square/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/otofu-square/awesome_events","description":"","fork":false,"url":"https://api.github.com/repos/otofu-square/awesome_events","forks_url":"https://api.github.com/repos/otofu-square/awesome_events/forks","keys_url":"https://api.github.com/repos/otofu-square/awesome_events/keys{/key_id}","collaborators_url":"https://api.github.com/repos/otofu-square/awesome_events/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/otofu-square/awesome_events/teams","hooks_url":"https://api.github.com/repos/otofu-square/awesome_events/hooks","issue_events_url":"https://api.github.com/repos/otofu-square/awesome_events/issues/events{/number}","events_url":"https://api.github.com/repos/otofu-square/awesome_events/events","assignees_url":"https://api.github.com/repos/otofu-square/awesome_events/assignees{/user}","branches_url":"https://api.github.com/repos/otofu-square/awesome_events/branches{/branch}","tags_url":"https://api.github.com/repos/otofu-square/awesome_events/tags","blobs_url":"https://api.github.com/repos/otofu-square/awesome_events/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/otofu-square/awesome_events/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/otofu-square/awesome_events/git/refs{/sha}","trees_url":"https://api.github.com/repos/otofu-square/awesome_events/git/trees{/sha}","statuses_url":"https://api.github.com/repos/otofu-square/awesome_events/statuses/{sha}","languages_url":"https://api.github.com/repos/otofu-square/awesome_events/languages","stargazers_url":"https://api.github.com/repos/otofu-square/awesome_events/stargazers","contributors_url":"https://api.github.com/repos/otofu-square/awesome_events/contributors","subscribers_url":"https://api.github.com/repos/otofu-square/awesome_events/subscribers","subscription_url":"https://api.github.com/repos/otofu-square/awesome_events/subscription","commits_url":"https://api.github.com/repos/otofu-square/awesome_events/commits{/sha}","git_commits_url":"https://api.github.com/repos/otofu-square/awesome_events/git/commits{/sha}","comments_url":"https://api.github.com/repos/otofu-square/awesome_events/comments{/number}","issue_comment_url":"https://api.github.com/repos/otofu-square/awesome_events/issues/comments{/number}","contents_url":"https://api.github.com/repos/otofu-square/awesome_events/contents/{+path}","compare_url":"https://api.github.com/repos/otofu-square/awesome_events/compare/{base}...{head}","merges_url":"https://api.github.com/repos/otofu-square/awesome_events/merges","archive_url":"https://api.github.com/repos/otofu-square/awesome_events/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/otofu-square/awesome_events/downloads","issues_url":"https://api.github.com/repos/otofu-square/awesome_events/issues{/number}","pulls_url":"https://api.github.com/repos/otofu-square/awesome_events/pulls{/number}","milestones_url":"https://api.github.com/repos/otofu-square/awesome_events/milestones{/number}","notifications_url":"https://api.github.com/repos/otofu-square/awesome_events/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/otofu-square/awesome_events/labels{/name}","releases_url":"https://api.github.com/repos/otofu-square/awesome_events/releases{/id}","deployments_url":"https://api.github.com/repos/otofu-square/awesome_events/deployments","created_at":"2016-05-24T02:51:04Z","updated_at":"2016-05-25T02:10:47Z","pushed_at":"2016-06-08T16:19:27Z","git_url":"git://github.com/otofu-square/awesome_events.git","ssh_url":"git@github.com:otofu-square/awesome_events.git","clone_url":"https://github.com/otofu-square/awesome_events.git","svn_url":"https://github.com/otofu-square/awesome_events","homepage":null,"size":122,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/otofu-square/awesome_events/pulls/14"},"html":{"href":"https://github.com/otofu-square/awesome_events/pull/14"},"issue":{"href":"https://api.github.com/repos/otofu-square/awesome_events/issues/14"},"comments":{"href":"https://api.github.com/repos/otofu-square/awesome_events/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/otofu-square/awesome_events/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/otofu-square/awesome_events/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/otofu-square/awesome_events/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/otofu-square/awesome_events/statuses/2e6a5c93899751d7a5f1e5e84d3f260e5c290c8d"}}}}
{"actor":{"display_login":"otofu-square"}}