{"action":"created","comment":{"url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/comments/185632580","pull_request_review_id":117060486,"id":185632580,"diff_hunk":"@@ -23,93 +36,250 @@\n   describe \"index\" do\n     it \"succeeds when there are works\" do\n \n+        existing_user = users(:dan)\n+\n+        perform_login(existing_user)\n+\n+      get works_path\n+      must_respond_with :success\n     end\n \n     it \"succeeds when there are no works\" do\n-\n+      existing_user = users(:dan)\n+\n+      perform_login(existing_user)\n+      works = Work.all\n+      works.each do |work|\n+        work.votes.destroy\n+        work.destroy\n+      end\n+      get works_path\n+      must_respond_with :success\n     end\n   end\n \n   describe \"new\" do\n     it \"succeeds\" do\n+      existing_user = users(:dan)\n \n-    end\n+      perform_login(existing_user)\n+      get new_work_path\n+     end\n   end\n \n   describe \"create\" do\n     it \"creates a work with valid data for a real category\" do\n \n+      existing_user = users(:dan)\n+\n+      perform_login(existing_user)\n+\n+      proc {\n+        post works_path, params: {\n+          work: {\n+            title: 'Harry Potter',\n+            creator: 'Wizards',\n+            description: 'magic',\n+            publication_year: 1955,\n+            category: :book\n+          }\n+        }\n+      }.must_change 'Work.count', 1\n+\n+      must_respond_with :redirect\n+      must_redirect_to work_path(Work.find_by(title: 'Harry Potter').id)\n     end\n \n     it \"renders bad_request and does not update the DB for bogus data\" do\n-\n+      existing_user = users(:dan)\n+\n+      perform_login(existing_user)\n+\n+      proc {\n+        post works_path, params: {\n+          work: {\n+            creator: 'Wizards',\n+            description: 'magic',\n+            publication_year: 1955,\n+            category: :book\n+          }\n+        }\n+      }.must_change 'Work.count', 0\n+\n+      must_respond_with :bad_request\n     end\n \n     it \"renders 400 bad_request for bogus categories\" do\n-\n+      existing_user = users(:dan)\n+\n+      perform_login(existing_user)\n+      proc {\n+        post works_path, params: {\n+          work: {\n+            title: 'Harry Potter',\n+            creator: 'Wizards',\n+            description: 'magic',\n+            publication_year: 1955,\n+            category: \"nope\"\n+          }\n+        }\n+      }.must_change 'Work.count', 0\n+\n+      must_respond_with :bad_request\n     end\n \n   end\n \n   describe \"show\" do\n     it \"succeeds for an extant work ID\" do\n+      existing_user = users(:dan)\n \n+      perform_login(existing_user)\n+      get work_path(Work.find(works(:movie).id))\n+      must_respond_with :success\n     end\n \n     it \"renders 404 not_found for a bogus work ID\" do\n+      existing_user = users(:dan)\n \n+      perform_login(existing_user)\n+      get work_path(789)\n+      must_respond_with 404\n     end\n   end\n \n   describe \"edit\" do\n     it \"succeeds for an extant work ID\" do\n+      existing_user = users(:dan)\n+\n+      perform_login(existing_user)\n+      get edit_work_path(Work.find(works(:movie).id))\n+      must_respond_with :success\n \n     end\n \n     it \"renders 404 not_found for a bogus work ID\" do\n+      existing_user = users(:dan)\n \n+      perform_login(existing_user)\n+      get edit_work_path(789)\n+      must_respond_with 404\n     end\n   end\n \n   describe \"update\" do\n     it \"succeeds for valid data and an extant work ID\" do\n-\n+      existing_user = users(:dan)\n+\n+      perform_login(existing_user)\n+      updated_title = \"The best title\"\n+\n+      put work_path(works(:movie).id), params: {\n+        work: {\n+          title: updated_title,\n+          category: :movie\n+        }\n+      }\n+\n+      updated_work = Work.find(works(:movie).id)\n+      updated_work.title.must_equal \"The best title\"\n+      must_respond_with :redirect\n+      must_redirect_to work_path(Work.find(works(:movie).id))\n     end\n \n     it \"renders bad_request for bogus data\" do\n+      existing_user = users(:dan)\n+\n+      perform_login(existing_user)\n+\n+      put work_path(works(:movie).id), params: {\n+        work: {\n+          category: \"beans\"\n+        }\n+      }\n+\n+      must_respond_with 404\n \n     end\n \n     it \"renders 404 not_found for a bogus work ID\" do\n+      existing_user = users(:dan)\n+\n+      perform_login(existing_user)\n+      put work_path(789)\n+      must_respond_with 404\n \n     end\n   end\n \n   describe \"destroy\" do\n     it \"succeeds for an extant work ID\" do\n+      existing_user = users(:dan)\n \n+      perform_login(existing_user)\n+      delete work_path(Work.find(works(:movie).id))\n+      must_respond_with :redirect\n+      must_redirect_to root_path\n     end\n \n     it \"renders 404 not_found and does not update the DB for a bogus work ID\" do\n+      existing_user = users(:dan)\n \n+      perform_login(existing_user)\n+\n+      delete work_path(789)\n+      must_respond_with 404\n     end\n   end\n \n   describe \"upvote\" do\n \n     it \"redirects to the work page if no user is logged in\" do\n+      existing_user = users(:dan)","path":"test/controllers/works_controller_test.rb","position":243,"original_position":243,"commit_id":"c2e689f860e61815ede973f33bb0ddadd8a63957","original_commit_id":"c2e689f860e61815ede973f33bb0ddadd8a63957","user":{"login":"CheezItMan","id":1177416,"avatar_url":"https://avatars3.githubusercontent.com/u/1177416?v=4","gravatar_id":"","url":"https://api.github.com/users/CheezItMan","html_url":"https://github.com/CheezItMan","followers_url":"https://api.github.com/users/CheezItMan/followers","following_url":"https://api.github.com/users/CheezItMan/following{/other_user}","gists_url":"https://api.github.com/users/CheezItMan/gists{/gist_id}","starred_url":"https://api.github.com/users/CheezItMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CheezItMan/subscriptions","organizations_url":"https://api.github.com/users/CheezItMan/orgs","repos_url":"https://api.github.com/users/CheezItMan/repos","events_url":"https://api.github.com/users/CheezItMan/events{/privacy}","received_events_url":"https://api.github.com/users/CheezItMan/received_events","type":"User","site_admin":false},"body":"A flash notice check would also be appropriate in cases like this.","created_at":"2018-05-02T20:42:58Z","updated_at":"2018-05-02T20:48:28Z","html_url":"https://github.com/Ada-C9/MediaRanker-Revisited/pull/41#discussion_r185632580","pull_request_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/41","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/comments/185632580"},"html":{"href":"https://github.com/Ada-C9/MediaRanker-Revisited/pull/41#discussion_r185632580"},"pull_request":{"href":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/41"}}},"pull_request":{"url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/41","id":185485710,"html_url":"https://github.com/Ada-C9/MediaRanker-Revisited/pull/41","diff_url":"https://github.com/Ada-C9/MediaRanker-Revisited/pull/41.diff","patch_url":"https://github.com/Ada-C9/MediaRanker-Revisited/pull/41.patch","issue_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/issues/41","number":41,"state":"open","locked":false,"title":"Mary Ampers","user":{"login":"mmlamkin","id":25777061,"avatar_url":"https://avatars1.githubusercontent.com/u/25777061?v=4","gravatar_id":"","url":"https://api.github.com/users/mmlamkin","html_url":"https://github.com/mmlamkin","followers_url":"https://api.github.com/users/mmlamkin/followers","following_url":"https://api.github.com/users/mmlamkin/following{/other_user}","gists_url":"https://api.github.com/users/mmlamkin/gists{/gist_id}","starred_url":"https://api.github.com/users/mmlamkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmlamkin/subscriptions","organizations_url":"https://api.github.com/users/mmlamkin/orgs","repos_url":"https://api.github.com/users/mmlamkin/repos","events_url":"https://api.github.com/users/mmlamkin/events{/privacy}","received_events_url":"https://api.github.com/users/mmlamkin/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-02T16:01:39Z","updated_at":"2018-05-02T20:48:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b04d67c435ecb11e9e83948a4c49d7d745aebff6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/41/commits","review_comments_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/41/comments","review_comment_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/issues/41/comments","statuses_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/statuses/c2e689f860e61815ede973f33bb0ddadd8a63957","head":{"label":"mmlamkin:master","ref":"master","sha":"c2e689f860e61815ede973f33bb0ddadd8a63957","user":{"login":"mmlamkin","id":25777061,"avatar_url":"https://avatars1.githubusercontent.com/u/25777061?v=4","gravatar_id":"","url":"https://api.github.com/users/mmlamkin","html_url":"https://github.com/mmlamkin","followers_url":"https://api.github.com/users/mmlamkin/followers","following_url":"https://api.github.com/users/mmlamkin/following{/other_user}","gists_url":"https://api.github.com/users/mmlamkin/gists{/gist_id}","starred_url":"https://api.github.com/users/mmlamkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmlamkin/subscriptions","organizations_url":"https://api.github.com/users/mmlamkin/orgs","repos_url":"https://api.github.com/users/mmlamkin/repos","events_url":"https://api.github.com/users/mmlamkin/events{/privacy}","received_events_url":"https://api.github.com/users/mmlamkin/received_events","type":"User","site_admin":false},"repo":{"id":129786283,"name":"MediaRanker-Revisited","full_name":"mmlamkin/MediaRanker-Revisited","owner":{"login":"mmlamkin","id":25777061,"avatar_url":"https://avatars1.githubusercontent.com/u/25777061?v=4","gravatar_id":"","url":"https://api.github.com/users/mmlamkin","html_url":"https://github.com/mmlamkin","followers_url":"https://api.github.com/users/mmlamkin/followers","following_url":"https://api.github.com/users/mmlamkin/following{/other_user}","gists_url":"https://api.github.com/users/mmlamkin/gists{/gist_id}","starred_url":"https://api.github.com/users/mmlamkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmlamkin/subscriptions","organizations_url":"https://api.github.com/users/mmlamkin/orgs","repos_url":"https://api.github.com/users/mmlamkin/repos","events_url":"https://api.github.com/users/mmlamkin/events{/privacy}","received_events_url":"https://api.github.com/users/mmlamkin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mmlamkin/MediaRanker-Revisited","description":"Project: Add controller tests and OAuth to an existing project","fork":true,"url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited","forks_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/forks","keys_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/teams","hooks_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/hooks","issue_events_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/issues/events{/number}","events_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/events","assignees_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/assignees{/user}","branches_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/branches{/branch}","tags_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/tags","blobs_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/git/refs{/sha}","trees_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/statuses/{sha}","languages_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/languages","stargazers_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/stargazers","contributors_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/contributors","subscribers_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/subscribers","subscription_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/subscription","commits_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/commits{/sha}","git_commits_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/git/commits{/sha}","comments_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/comments{/number}","issue_comment_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/issues/comments{/number}","contents_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/contents/{+path}","compare_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/merges","archive_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/downloads","issues_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/issues{/number}","pulls_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/pulls{/number}","milestones_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/milestones{/number}","notifications_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/labels{/name}","releases_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/releases{/id}","deployments_url":"https://api.github.com/repos/mmlamkin/MediaRanker-Revisited/deployments","created_at":"2018-04-16T18:13:19Z","updated_at":"2018-05-02T16:02:43Z","pushed_at":"2018-05-02T16:02:41Z","git_url":"git://github.com/mmlamkin/MediaRanker-Revisited.git","ssh_url":"git@github.com:mmlamkin/MediaRanker-Revisited.git","clone_url":"https://github.com/mmlamkin/MediaRanker-Revisited.git","svn_url":"https://github.com/mmlamkin/MediaRanker-Revisited","homepage":"","size":148,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Ada-C9:master","ref":"master","sha":"ed23eaab3bc988f1f3b0a8590c08994bceba8212","user":{"login":"Ada-C9","id":35278806,"avatar_url":"https://avatars0.githubusercontent.com/u/35278806?v=4","gravatar_id":"","url":"https://api.github.com/users/Ada-C9","html_url":"https://github.com/Ada-C9","followers_url":"https://api.github.com/users/Ada-C9/followers","following_url":"https://api.github.com/users/Ada-C9/following{/other_user}","gists_url":"https://api.github.com/users/Ada-C9/gists{/gist_id}","starred_url":"https://api.github.com/users/Ada-C9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ada-C9/subscriptions","organizations_url":"https://api.github.com/users/Ada-C9/orgs","repos_url":"https://api.github.com/users/Ada-C9/repos","events_url":"https://api.github.com/users/Ada-C9/events{/privacy}","received_events_url":"https://api.github.com/users/Ada-C9/received_events","type":"Organization","site_admin":false},"repo":{"id":129775578,"name":"MediaRanker-Revisited","full_name":"Ada-C9/MediaRanker-Revisited","owner":{"login":"Ada-C9","id":35278806,"avatar_url":"https://avatars0.githubusercontent.com/u/35278806?v=4","gravatar_id":"","url":"https://api.github.com/users/Ada-C9","html_url":"https://github.com/Ada-C9","followers_url":"https://api.github.com/users/Ada-C9/followers","following_url":"https://api.github.com/users/Ada-C9/following{/other_user}","gists_url":"https://api.github.com/users/Ada-C9/gists{/gist_id}","starred_url":"https://api.github.com/users/Ada-C9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ada-C9/subscriptions","organizations_url":"https://api.github.com/users/Ada-C9/orgs","repos_url":"https://api.github.com/users/Ada-C9/repos","events_url":"https://api.github.com/users/Ada-C9/events{/privacy}","received_events_url":"https://api.github.com/users/Ada-C9/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Ada-C9/MediaRanker-Revisited","description":"Project: Add controller tests and OAuth to an existing project","fork":true,"url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited","forks_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/forks","keys_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/teams","hooks_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/hooks","issue_events_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/issues/events{/number}","events_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/events","assignees_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/assignees{/user}","branches_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/branches{/branch}","tags_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/tags","blobs_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/statuses/{sha}","languages_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/languages","stargazers_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/stargazers","contributors_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/contributors","subscribers_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/subscribers","subscription_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/subscription","commits_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/contents/{+path}","compare_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/merges","archive_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/downloads","issues_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/issues{/number}","pulls_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls{/number}","milestones_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/milestones{/number}","notifications_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/labels{/name}","releases_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/releases{/id}","deployments_url":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/deployments","created_at":"2018-04-16T16:43:26Z","updated_at":"2018-04-29T14:49:51Z","pushed_at":"2018-05-02T16:11:38Z","git_url":"git://github.com/Ada-C9/MediaRanker-Revisited.git","ssh_url":"git@github.com:Ada-C9/MediaRanker-Revisited.git","clone_url":"https://github.com/Ada-C9/MediaRanker-Revisited.git","svn_url":"https://github.com/Ada-C9/MediaRanker-Revisited","homepage":"","size":132,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"archived":false,"open_issues_count":41,"license":null,"forks":47,"open_issues":41,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/41"},"html":{"href":"https://github.com/Ada-C9/MediaRanker-Revisited/pull/41"},"issue":{"href":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/issues/41"},"comments":{"href":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/Ada-C9/MediaRanker-Revisited/statuses/c2e689f860e61815ede973f33bb0ddadd8a63957"}},"author_association":"NONE"}}
{"actor":{"display_login":"CheezItMan"}}