{"action":"created","comment":{"url":"https://api.github.com/repos/t584/myflix/pulls/comments/30299742","id":30299742,"diff_hunk":"@@ -0,0 +1,118 @@\n+require 'spec_helper'\n+\n+describe QueueItemsController do\n+  describe \"GET index\" do\n+    it \"sets @queue_items to the queue items of the logged in user\" do\n+      alice = Fabricate(:user)\n+      session[:user_id] = alice.id\n+      queue_item1 = Fabricate(:queue_item, user: alice)\n+      queue_item2 = Fabricate(:queue_item, user: alice)\n+      get :index\n+      expect(assigns(:queue_items)).to match_array([queue_item1, queue_item2])\n+    end\n+\n+    it \"redirects to the sign in page for unauthenticated users\" do\n+      get :index\n+      expect(response).to redirect_to sign_in_path\n+    end\n+  end\n+\n+  describe \"POST create\" do\n+    it \"redirects to the my queue page\" do\n+      session[:user_id] = Fabricate(:user).id\n+      video = Fabricate(:video)\n+      post :create, video_id: video.id\n+      expect(response).to redirect_to my_queue_path\n+    end\n+    it \"creates a queue item\" do\n+      session[:user_id] = Fabricate(:user).id\n+      video = Fabricate(:video)\n+      post :create, video_id: video.id\n+      expect(QueueItem.count).to eq(1)\n+    end\n+    it \"creates the queue item that is associated with the video\" do\n+      session[:user_id] = Fabricate(:user).id\n+      video = Fabricate(:video)\n+      post :create, video_id: video.id\n+      expect(QueueItem.first.video).to eq(video)\n+    end\n+    it \"creates the queue item that is associated with the signed in user\" do\n+      alice = Fabricate(:user)\n+      session[:user_id] = alice.id\n+      video = Fabricate(:video)\n+      post :create, video_id: video.id\n+      expect(QueueItem.first.user).to eq(alice)\n+    end\n+    it \"puts the video as the last one in the queue\" do\n+      alice = Fabricate(:user)\n+      session[:user_id] = alice.id\n+      monk = Fabricate(:video)\n+      Fabricate(:queue_item, video: monk, user: alice)\n+      south_park = Fabricate(:video)\n+      post :create, video_id: south_park.id\n+      south_park_queue_item = QueueItem.where(video_id: south_park.id, user_id: alice.id).first\n+      expect(south_park_queue_item.position).to eq(2)\n+    end\n+    it \"does not add the video to the queue if the voideo is already in the queue\" do\n+      alice = Fabricate(:user)\n+      session[:user_id] = alice.id\n+      monk = Fabricate(:video)\n+      Fabricate(:queue_item, video: monk, user: alice)\n+      post :create, video_id: monk.id\n+      expect(alice.queue_items.count).to eq(1)\n+    end\n+\n+    it \"redirects to the sign in page for unauthenticated users\" do\n+      post :create, video_id: 3\n+      expect(response).to redirect_to sign_in_path\n+    end\n+  end\n+\n+  describe \"DELETE destroy\" do\n+\n+    # it \"deletes selected video from my queue page\" do\n+    #   alice = Fabricate(:user)\n+    #   session[:user_id] = alice.id\n+    #   monk = Fabricate(:video)\n+    #   Fabricate(:queue_item, video: monk, user: alice)\n+    #   south_park = Fabricate(:video)\n+    #   post :create, video_id: south_park.id\n+    #   south_park_queue_item = QueueItem.where(video_id: south_park.id, user_id: alice.id).first\n+    #   delete :destroy, video_id: monk.id\n+    #   expect(alice.queue_items.count).to eq(1)\n+    #   expect(south_park_queue_item.position).to eq(1)\n+    #   expect(response).to redirect_to my_queue_path\n+    # end\n+\n+    it \"redirects to the my queue page\" do\n+      alice = Fabricate(:user)\n+      session[:user_id] = alice.id\n+      queue_item = Fabricate(:queue_item, user: alice)\n+      delete :destroy, id: queue_item.id\n+      expect(QueueItem.count).to eq(0)","path":"spec/controllers/queue_items_controller_spec.rb","position":92,"original_position":92,"commit_id":"f6c0970ef99cd06f48c9f8211e887969f04ad2f4","original_commit_id":"f6c0970ef99cd06f48c9f8211e887969f04ad2f4","user":{"login":"t584","id":7085545,"avatar_url":"https://avatars.githubusercontent.com/u/7085545?v=3","gravatar_id":"","url":"https://api.github.com/users/t584","html_url":"https://github.com/t584","followers_url":"https://api.github.com/users/t584/followers","following_url":"https://api.github.com/users/t584/following{/other_user}","gists_url":"https://api.github.com/users/t584/gists{/gist_id}","starred_url":"https://api.github.com/users/t584/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t584/subscriptions","organizations_url":"https://api.github.com/users/t584/orgs","repos_url":"https://api.github.com/users/t584/repos","events_url":"https://api.github.com/users/t584/events{/privacy}","received_events_url":"https://api.github.com/users/t584/received_events","type":"User","site_admin":false},"body":"thanks for all the detailed feedback!","created_at":"2015-05-14T06:02:55Z","updated_at":"2015-05-14T06:02:55Z","html_url":"https://github.com/t584/myflix/pull/2#discussion_r30299742","pull_request_url":"https://api.github.com/repos/t584/myflix/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/t584/myflix/pulls/comments/30299742"},"html":{"href":"https://github.com/t584/myflix/pull/2#discussion_r30299742"},"pull_request":{"href":"https://api.github.com/repos/t584/myflix/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/t584/myflix/pulls/2","id":35380534,"html_url":"https://github.com/t584/myflix/pull/2","diff_url":"https://github.com/t584/myflix/pull/2.diff","patch_url":"https://github.com/t584/myflix/pull/2.patch","issue_url":"https://api.github.com/repos/t584/myflix/issues/2","number":2,"state":"open","locked":false,"title":"Wk02 2nd Code Review","user":{"login":"t584","id":7085545,"avatar_url":"https://avatars.githubusercontent.com/u/7085545?v=3","gravatar_id":"","url":"https://api.github.com/users/t584","html_url":"https://github.com/t584","followers_url":"https://api.github.com/users/t584/followers","following_url":"https://api.github.com/users/t584/following{/other_user}","gists_url":"https://api.github.com/users/t584/gists{/gist_id}","starred_url":"https://api.github.com/users/t584/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t584/subscriptions","organizations_url":"https://api.github.com/users/t584/orgs","repos_url":"https://api.github.com/users/t584/repos","events_url":"https://api.github.com/users/t584/events{/privacy}","received_events_url":"https://api.github.com/users/t584/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-13T23:15:40Z","updated_at":"2015-05-14T06:02:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b6e78a065be81e416fe00d30121ea4224ad1ca63","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/t584/myflix/pulls/2/commits","review_comments_url":"https://api.github.com/repos/t584/myflix/pulls/2/comments","review_comment_url":"https://api.github.com/repos/t584/myflix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/t584/myflix/issues/2/comments","statuses_url":"https://api.github.com/repos/t584/myflix/statuses/f6c0970ef99cd06f48c9f8211e887969f04ad2f4","head":{"label":"t584:wk02-2","ref":"wk02-2","sha":"f6c0970ef99cd06f48c9f8211e887969f04ad2f4","user":{"login":"t584","id":7085545,"avatar_url":"https://avatars.githubusercontent.com/u/7085545?v=3","gravatar_id":"","url":"https://api.github.com/users/t584","html_url":"https://github.com/t584","followers_url":"https://api.github.com/users/t584/followers","following_url":"https://api.github.com/users/t584/following{/other_user}","gists_url":"https://api.github.com/users/t584/gists{/gist_id}","starred_url":"https://api.github.com/users/t584/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t584/subscriptions","organizations_url":"https://api.github.com/users/t584/orgs","repos_url":"https://api.github.com/users/t584/repos","events_url":"https://api.github.com/users/t584/events{/privacy}","received_events_url":"https://api.github.com/users/t584/received_events","type":"User","site_admin":false},"repo":{"id":34650135,"name":"myflix","full_name":"t584/myflix","owner":{"login":"t584","id":7085545,"avatar_url":"https://avatars.githubusercontent.com/u/7085545?v=3","gravatar_id":"","url":"https://api.github.com/users/t584","html_url":"https://github.com/t584","followers_url":"https://api.github.com/users/t584/followers","following_url":"https://api.github.com/users/t584/following{/other_user}","gists_url":"https://api.github.com/users/t584/gists{/gist_id}","starred_url":"https://api.github.com/users/t584/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t584/subscriptions","organizations_url":"https://api.github.com/users/t584/orgs","repos_url":"https://api.github.com/users/t584/repos","events_url":"https://api.github.com/users/t584/events{/privacy}","received_events_url":"https://api.github.com/users/t584/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/t584/myflix","description":"","fork":false,"url":"https://api.github.com/repos/t584/myflix","forks_url":"https://api.github.com/repos/t584/myflix/forks","keys_url":"https://api.github.com/repos/t584/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/t584/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/t584/myflix/teams","hooks_url":"https://api.github.com/repos/t584/myflix/hooks","issue_events_url":"https://api.github.com/repos/t584/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/t584/myflix/events","assignees_url":"https://api.github.com/repos/t584/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/t584/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/t584/myflix/tags","blobs_url":"https://api.github.com/repos/t584/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/t584/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/t584/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/t584/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/t584/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/t584/myflix/languages","stargazers_url":"https://api.github.com/repos/t584/myflix/stargazers","contributors_url":"https://api.github.com/repos/t584/myflix/contributors","subscribers_url":"https://api.github.com/repos/t584/myflix/subscribers","subscription_url":"https://api.github.com/repos/t584/myflix/subscription","commits_url":"https://api.github.com/repos/t584/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/t584/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/t584/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/t584/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/t584/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/t584/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/t584/myflix/merges","archive_url":"https://api.github.com/repos/t584/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/t584/myflix/downloads","issues_url":"https://api.github.com/repos/t584/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/t584/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/t584/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/t584/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/t584/myflix/labels{/name}","releases_url":"https://api.github.com/repos/t584/myflix/releases{/id}","created_at":"2015-04-27T06:39:45Z","updated_at":"2015-05-05T05:11:42Z","pushed_at":"2015-05-13T23:15:41Z","git_url":"git://github.com/t584/myflix.git","ssh_url":"git@github.com:t584/myflix.git","clone_url":"https://github.com/t584/myflix.git","svn_url":"https://github.com/t584/myflix","homepage":null,"size":1396,"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":"t584:master","ref":"master","sha":"1aa765da2c7c208f6600829e8bfaa182c91dd35d","user":{"login":"t584","id":7085545,"avatar_url":"https://avatars.githubusercontent.com/u/7085545?v=3","gravatar_id":"","url":"https://api.github.com/users/t584","html_url":"https://github.com/t584","followers_url":"https://api.github.com/users/t584/followers","following_url":"https://api.github.com/users/t584/following{/other_user}","gists_url":"https://api.github.com/users/t584/gists{/gist_id}","starred_url":"https://api.github.com/users/t584/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t584/subscriptions","organizations_url":"https://api.github.com/users/t584/orgs","repos_url":"https://api.github.com/users/t584/repos","events_url":"https://api.github.com/users/t584/events{/privacy}","received_events_url":"https://api.github.com/users/t584/received_events","type":"User","site_admin":false},"repo":{"id":34650135,"name":"myflix","full_name":"t584/myflix","owner":{"login":"t584","id":7085545,"avatar_url":"https://avatars.githubusercontent.com/u/7085545?v=3","gravatar_id":"","url":"https://api.github.com/users/t584","html_url":"https://github.com/t584","followers_url":"https://api.github.com/users/t584/followers","following_url":"https://api.github.com/users/t584/following{/other_user}","gists_url":"https://api.github.com/users/t584/gists{/gist_id}","starred_url":"https://api.github.com/users/t584/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t584/subscriptions","organizations_url":"https://api.github.com/users/t584/orgs","repos_url":"https://api.github.com/users/t584/repos","events_url":"https://api.github.com/users/t584/events{/privacy}","received_events_url":"https://api.github.com/users/t584/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/t584/myflix","description":"","fork":false,"url":"https://api.github.com/repos/t584/myflix","forks_url":"https://api.github.com/repos/t584/myflix/forks","keys_url":"https://api.github.com/repos/t584/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/t584/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/t584/myflix/teams","hooks_url":"https://api.github.com/repos/t584/myflix/hooks","issue_events_url":"https://api.github.com/repos/t584/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/t584/myflix/events","assignees_url":"https://api.github.com/repos/t584/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/t584/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/t584/myflix/tags","blobs_url":"https://api.github.com/repos/t584/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/t584/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/t584/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/t584/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/t584/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/t584/myflix/languages","stargazers_url":"https://api.github.com/repos/t584/myflix/stargazers","contributors_url":"https://api.github.com/repos/t584/myflix/contributors","subscribers_url":"https://api.github.com/repos/t584/myflix/subscribers","subscription_url":"https://api.github.com/repos/t584/myflix/subscription","commits_url":"https://api.github.com/repos/t584/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/t584/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/t584/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/t584/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/t584/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/t584/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/t584/myflix/merges","archive_url":"https://api.github.com/repos/t584/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/t584/myflix/downloads","issues_url":"https://api.github.com/repos/t584/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/t584/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/t584/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/t584/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/t584/myflix/labels{/name}","releases_url":"https://api.github.com/repos/t584/myflix/releases{/id}","created_at":"2015-04-27T06:39:45Z","updated_at":"2015-05-05T05:11:42Z","pushed_at":"2015-05-13T23:15:41Z","git_url":"git://github.com/t584/myflix.git","ssh_url":"git@github.com:t584/myflix.git","clone_url":"https://github.com/t584/myflix.git","svn_url":"https://github.com/t584/myflix","homepage":null,"size":1396,"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/t584/myflix/pulls/2"},"html":{"href":"https://github.com/t584/myflix/pull/2"},"issue":{"href":"https://api.github.com/repos/t584/myflix/issues/2"},"comments":{"href":"https://api.github.com/repos/t584/myflix/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/t584/myflix/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/t584/myflix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/t584/myflix/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/t584/myflix/statuses/f6c0970ef99cd06f48c9f8211e887969f04ad2f4"}}}}