{"action":"created","comment":{"url":"https://api.github.com/repos/Reltre/myflix/pulls/comments/38825459","id":38825459,"diff_hunk":"@@ -3,4 +3,49 @@\n describe Category, type: :model do\n   it { should have_many(:videos) }\n   it { should validate_presence_of(:name) }\n+\n+  describe \"#recent_videos\" do\n+    before :each do\n+      @test_category = Category.create(name: \"drama\")\n+    end\n+\n+    it \"returns an empty array if no videos are in the database\" do\n+      expect(@test_category.recent_videos).to eq([])\n+    end\n+\n+    it \"returns all the videos if there are less than 6 of them\" do\n+      futurama = Video.create(title: \"futurama\", description: \"year 3000\")\n+      south_park = Video.create(title: \"south park\", description: \"colorado funny\")\n+      family_guy = Video.create(title: \"family guy\", description: \"family shenanagins\")\n+\n+      @test_category.videos << [futurama, south_park, family_guy]\n+      expect(@test_category.recent_videos.size).to eq(3)\n+    end\n+\n+    it \"returns 6 videos if there are more than 6 videos\" do\n+      7.times { Video.create(title: \"one piece\", description: \"pirate king\") }\n+      @test_category.videos << Video.all\n+\n+      expect(@test_category.recent_videos.size).to eq(6)\n+    end\n+\n+    it \"returns videos in descending order by created at\" do\n+      monk = Video.create(title: \"monk\", description: \"detective work\")\n+      south_park = Video.create(title: \"south park\", description: \"colorado funny\")\n+      futurama = Video.create(title: \"family guy\", description: \"family shenanagins\")\n+\n+      @test_category.videos << [south_park, monk, futurama]\n+\n+      expect(@test_category.recent_videos).to eq([futurama,south_park,monk])\n+    end\n+\n+    it \"returns the most recent 6 videos\" do\n+      7.times do |video_number|\n+        Video.create(title: \"#{video_number}\", description: \"a video\",","path":"spec/models/category_spec.rb","position":42,"original_position":42,"commit_id":"04c2f2e6c8505b40cb7209cd3ec68f01f6b97d17","original_commit_id":"04c2f2e6c8505b40cb7209cd3ec68f01f6b97d17","user":{"login":"tomtomecek","id":7385469,"avatar_url":"https://avatars.githubusercontent.com/u/7385469?v=3","gravatar_id":"","url":"https://api.github.com/users/tomtomecek","html_url":"https://github.com/tomtomecek","followers_url":"https://api.github.com/users/tomtomecek/followers","following_url":"https://api.github.com/users/tomtomecek/following{/other_user}","gists_url":"https://api.github.com/users/tomtomecek/gists{/gist_id}","starred_url":"https://api.github.com/users/tomtomecek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomtomecek/subscriptions","organizations_url":"https://api.github.com/users/tomtomecek/orgs","repos_url":"https://api.github.com/users/tomtomecek/repos","events_url":"https://api.github.com/users/tomtomecek/events{/privacy}","received_events_url":"https://api.github.com/users/tomtomecek/received_events","type":"User","site_admin":false},"body":"There is no need to interpolate this. Fine w/o it.","created_at":"2015-09-06T20:02:46Z","updated_at":"2015-09-06T20:02:46Z","html_url":"https://github.com/Reltre/myflix/pull/2#discussion_r38825459","pull_request_url":"https://api.github.com/repos/Reltre/myflix/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/Reltre/myflix/pulls/comments/38825459"},"html":{"href":"https://github.com/Reltre/myflix/pull/2#discussion_r38825459"},"pull_request":{"href":"https://api.github.com/repos/Reltre/myflix/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/Reltre/myflix/pulls/2","id":44306845,"html_url":"https://github.com/Reltre/myflix/pull/2","diff_url":"https://github.com/Reltre/myflix/pull/2.diff","patch_url":"https://github.com/Reltre/myflix/pull/2.patch","issue_url":"https://api.github.com/repos/Reltre/myflix/issues/2","number":2,"state":"open","locked":false,"title":"Course 3 Week 1 implementation","user":{"login":"Reltre","id":5009737,"avatar_url":"https://avatars.githubusercontent.com/u/5009737?v=3","gravatar_id":"","url":"https://api.github.com/users/Reltre","html_url":"https://github.com/Reltre","followers_url":"https://api.github.com/users/Reltre/followers","following_url":"https://api.github.com/users/Reltre/following{/other_user}","gists_url":"https://api.github.com/users/Reltre/gists{/gist_id}","starred_url":"https://api.github.com/users/Reltre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reltre/subscriptions","organizations_url":"https://api.github.com/users/Reltre/orgs","repos_url":"https://api.github.com/users/Reltre/repos","events_url":"https://api.github.com/users/Reltre/events{/privacy}","received_events_url":"https://api.github.com/users/Reltre/received_events","type":"User","site_admin":false},"body":"Includes updates to base myflix project.  User authentication is included along with the setup of the home page and landing page.","created_at":"2015-09-06T17:57:24Z","updated_at":"2015-09-06T20:02:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be4083c7c15bb1980435f40f0d7ca8cc09e5d7e0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Reltre/myflix/pulls/2/commits","review_comments_url":"https://api.github.com/repos/Reltre/myflix/pulls/2/comments","review_comment_url":"https://api.github.com/repos/Reltre/myflix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Reltre/myflix/issues/2/comments","statuses_url":"https://api.github.com/repos/Reltre/myflix/statuses/04c2f2e6c8505b40cb7209cd3ec68f01f6b97d17","head":{"label":"Reltre:mod1","ref":"mod1","sha":"04c2f2e6c8505b40cb7209cd3ec68f01f6b97d17","user":{"login":"Reltre","id":5009737,"avatar_url":"https://avatars.githubusercontent.com/u/5009737?v=3","gravatar_id":"","url":"https://api.github.com/users/Reltre","html_url":"https://github.com/Reltre","followers_url":"https://api.github.com/users/Reltre/followers","following_url":"https://api.github.com/users/Reltre/following{/other_user}","gists_url":"https://api.github.com/users/Reltre/gists{/gist_id}","starred_url":"https://api.github.com/users/Reltre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reltre/subscriptions","organizations_url":"https://api.github.com/users/Reltre/orgs","repos_url":"https://api.github.com/users/Reltre/repos","events_url":"https://api.github.com/users/Reltre/events{/privacy}","received_events_url":"https://api.github.com/users/Reltre/received_events","type":"User","site_admin":false},"repo":{"id":40579341,"name":"myflix","full_name":"Reltre/myflix","owner":{"login":"Reltre","id":5009737,"avatar_url":"https://avatars.githubusercontent.com/u/5009737?v=3","gravatar_id":"","url":"https://api.github.com/users/Reltre","html_url":"https://github.com/Reltre","followers_url":"https://api.github.com/users/Reltre/followers","following_url":"https://api.github.com/users/Reltre/following{/other_user}","gists_url":"https://api.github.com/users/Reltre/gists{/gist_id}","starred_url":"https://api.github.com/users/Reltre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reltre/subscriptions","organizations_url":"https://api.github.com/users/Reltre/orgs","repos_url":"https://api.github.com/users/Reltre/repos","events_url":"https://api.github.com/users/Reltre/events{/privacy}","received_events_url":"https://api.github.com/users/Reltre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Reltre/myflix","description":"","fork":false,"url":"https://api.github.com/repos/Reltre/myflix","forks_url":"https://api.github.com/repos/Reltre/myflix/forks","keys_url":"https://api.github.com/repos/Reltre/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Reltre/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Reltre/myflix/teams","hooks_url":"https://api.github.com/repos/Reltre/myflix/hooks","issue_events_url":"https://api.github.com/repos/Reltre/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/Reltre/myflix/events","assignees_url":"https://api.github.com/repos/Reltre/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/Reltre/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/Reltre/myflix/tags","blobs_url":"https://api.github.com/repos/Reltre/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Reltre/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Reltre/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/Reltre/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Reltre/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/Reltre/myflix/languages","stargazers_url":"https://api.github.com/repos/Reltre/myflix/stargazers","contributors_url":"https://api.github.com/repos/Reltre/myflix/contributors","subscribers_url":"https://api.github.com/repos/Reltre/myflix/subscribers","subscription_url":"https://api.github.com/repos/Reltre/myflix/subscription","commits_url":"https://api.github.com/repos/Reltre/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/Reltre/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/Reltre/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/Reltre/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/Reltre/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/Reltre/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Reltre/myflix/merges","archive_url":"https://api.github.com/repos/Reltre/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Reltre/myflix/downloads","issues_url":"https://api.github.com/repos/Reltre/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/Reltre/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/Reltre/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/Reltre/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Reltre/myflix/labels{/name}","releases_url":"https://api.github.com/repos/Reltre/myflix/releases{/id}","created_at":"2015-08-12T03:57:36Z","updated_at":"2015-08-27T19:13:14Z","pushed_at":"2015-09-06T17:57:27Z","git_url":"git://github.com/Reltre/myflix.git","ssh_url":"git@github.com:Reltre/myflix.git","clone_url":"https://github.com/Reltre/myflix.git","svn_url":"https://github.com/Reltre/myflix","homepage":null,"size":404,"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":"Reltre:master","ref":"master","sha":"44aab00f4229c27d955d719e382cfb9ee66b7eee","user":{"login":"Reltre","id":5009737,"avatar_url":"https://avatars.githubusercontent.com/u/5009737?v=3","gravatar_id":"","url":"https://api.github.com/users/Reltre","html_url":"https://github.com/Reltre","followers_url":"https://api.github.com/users/Reltre/followers","following_url":"https://api.github.com/users/Reltre/following{/other_user}","gists_url":"https://api.github.com/users/Reltre/gists{/gist_id}","starred_url":"https://api.github.com/users/Reltre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reltre/subscriptions","organizations_url":"https://api.github.com/users/Reltre/orgs","repos_url":"https://api.github.com/users/Reltre/repos","events_url":"https://api.github.com/users/Reltre/events{/privacy}","received_events_url":"https://api.github.com/users/Reltre/received_events","type":"User","site_admin":false},"repo":{"id":40579341,"name":"myflix","full_name":"Reltre/myflix","owner":{"login":"Reltre","id":5009737,"avatar_url":"https://avatars.githubusercontent.com/u/5009737?v=3","gravatar_id":"","url":"https://api.github.com/users/Reltre","html_url":"https://github.com/Reltre","followers_url":"https://api.github.com/users/Reltre/followers","following_url":"https://api.github.com/users/Reltre/following{/other_user}","gists_url":"https://api.github.com/users/Reltre/gists{/gist_id}","starred_url":"https://api.github.com/users/Reltre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reltre/subscriptions","organizations_url":"https://api.github.com/users/Reltre/orgs","repos_url":"https://api.github.com/users/Reltre/repos","events_url":"https://api.github.com/users/Reltre/events{/privacy}","received_events_url":"https://api.github.com/users/Reltre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Reltre/myflix","description":"","fork":false,"url":"https://api.github.com/repos/Reltre/myflix","forks_url":"https://api.github.com/repos/Reltre/myflix/forks","keys_url":"https://api.github.com/repos/Reltre/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Reltre/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Reltre/myflix/teams","hooks_url":"https://api.github.com/repos/Reltre/myflix/hooks","issue_events_url":"https://api.github.com/repos/Reltre/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/Reltre/myflix/events","assignees_url":"https://api.github.com/repos/Reltre/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/Reltre/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/Reltre/myflix/tags","blobs_url":"https://api.github.com/repos/Reltre/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Reltre/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Reltre/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/Reltre/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Reltre/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/Reltre/myflix/languages","stargazers_url":"https://api.github.com/repos/Reltre/myflix/stargazers","contributors_url":"https://api.github.com/repos/Reltre/myflix/contributors","subscribers_url":"https://api.github.com/repos/Reltre/myflix/subscribers","subscription_url":"https://api.github.com/repos/Reltre/myflix/subscription","commits_url":"https://api.github.com/repos/Reltre/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/Reltre/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/Reltre/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/Reltre/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/Reltre/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/Reltre/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Reltre/myflix/merges","archive_url":"https://api.github.com/repos/Reltre/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Reltre/myflix/downloads","issues_url":"https://api.github.com/repos/Reltre/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/Reltre/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/Reltre/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/Reltre/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Reltre/myflix/labels{/name}","releases_url":"https://api.github.com/repos/Reltre/myflix/releases{/id}","created_at":"2015-08-12T03:57:36Z","updated_at":"2015-08-27T19:13:14Z","pushed_at":"2015-09-06T17:57:27Z","git_url":"git://github.com/Reltre/myflix.git","ssh_url":"git@github.com:Reltre/myflix.git","clone_url":"https://github.com/Reltre/myflix.git","svn_url":"https://github.com/Reltre/myflix","homepage":null,"size":404,"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/Reltre/myflix/pulls/2"},"html":{"href":"https://github.com/Reltre/myflix/pull/2"},"issue":{"href":"https://api.github.com/repos/Reltre/myflix/issues/2"},"comments":{"href":"https://api.github.com/repos/Reltre/myflix/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/Reltre/myflix/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/Reltre/myflix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Reltre/myflix/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/Reltre/myflix/statuses/04c2f2e6c8505b40cb7209cd3ec68f01f6b97d17"}}}}