{"action":"created","comment":{"url":"https://api.github.com/repos/moneyadviceservice/cms/pulls/comments/22456278","id":22456278,"diff_hunk":"@@ -0,0 +1,115 @@\n+require Rails.root.join('lib/comfortable_mexican_sofa/extensions/page')\n+\n+RSpec.describe Comfy::Cms::Page do\n+\n+  describe '#previous_page' do\n+    let(:english_site) { FactoryGirl.create :site }\n+    let(:welsh_site) { FactoryGirl.create :site, :welsh }\n+    let(:category) { FactoryGirl.create :category }\n+    let!(:first_article) { FactoryGirl.create :page, position: 1, site: english_site, categories: [category] }\n+\n+    it 'provides the previous article' do\n+      second_article = FactoryGirl.create :page, position: 2, site: english_site, categories: [category]\n+      expect(second_article.previous_page).to eq(first_article)\n+    end\n+\n+    it 'returns nil when there are no categories' do\n+      second_article = FactoryGirl.create :page, position: 2, site: english_site, categories: []\n+      expect(second_article.previous_page).to be_nil\n+    end\n+\n+    it 'returns nil when this is the first article' do\n+      expect(first_article.previous_page).to be_nil\n+    end\n+  end\n+\n+  describe '#next_page' do\n+    let(:english_site) { FactoryGirl.create :site }\n+    let(:welsh_site) { FactoryGirl.create :site, :welsh }\n+    let(:category) { FactoryGirl.create :category }\n+    let!(:second_article) { FactoryGirl.create :page, position: 2, site: english_site, categories: [category] }","path":"spec/lib/comfortable_mexican_sofa/extensions/page_spec.rb","position":28,"original_position":30,"commit_id":"24ae31938a3a09f4cb504b4b8208c2105f9e7050","original_commit_id":"701897633a1bfca4c93efcc83b121b56439aa1e2","user":{"login":"benlovell","id":41963,"avatar_url":"https://avatars.githubusercontent.com/u/41963?v=3","gravatar_id":"","url":"https://api.github.com/users/benlovell","html_url":"https://github.com/benlovell","followers_url":"https://api.github.com/users/benlovell/followers","following_url":"https://api.github.com/users/benlovell/following{/other_user}","gists_url":"https://api.github.com/users/benlovell/gists{/gist_id}","starred_url":"https://api.github.com/users/benlovell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benlovell/subscriptions","organizations_url":"https://api.github.com/users/benlovell/orgs","repos_url":"https://api.github.com/users/benlovell/repos","events_url":"https://api.github.com/users/benlovell/events{/privacy}","received_events_url":"https://api.github.com/users/benlovell/received_events","type":"User","site_admin":false},"body":"I vote `create`. We all know exactly where it comes from and it's the general standard everywhere else.","created_at":"2015-01-05T11:19:42Z","updated_at":"2015-01-05T11:19:42Z","html_url":"https://github.com/moneyadviceservice/cms/pull/120#discussion_r22456278","pull_request_url":"https://api.github.com/repos/moneyadviceservice/cms/pulls/120","_links":{"self":{"href":"https://api.github.com/repos/moneyadviceservice/cms/pulls/comments/22456278"},"html":{"href":"https://github.com/moneyadviceservice/cms/pull/120#discussion_r22456278"},"pull_request":{"href":"https://api.github.com/repos/moneyadviceservice/cms/pulls/120"}}},"pull_request":{"url":"https://api.github.com/repos/moneyadviceservice/cms/pulls/120","id":26516694,"html_url":"https://github.com/moneyadviceservice/cms/pull/120","diff_url":"https://github.com/moneyadviceservice/cms/pull/120.diff","patch_url":"https://github.com/moneyadviceservice/cms/pull/120.patch","issue_url":"https://api.github.com/repos/moneyadviceservice/cms/issues/120","number":120,"state":"open","locked":false,"title":"Add previous and next article functionality.","user":{"login":"neoeno","id":1007202,"avatar_url":"https://avatars.githubusercontent.com/u/1007202?v=3","gravatar_id":"","url":"https://api.github.com/users/neoeno","html_url":"https://github.com/neoeno","followers_url":"https://api.github.com/users/neoeno/followers","following_url":"https://api.github.com/users/neoeno/following{/other_user}","gists_url":"https://api.github.com/users/neoeno/gists{/gist_id}","starred_url":"https://api.github.com/users/neoeno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neoeno/subscriptions","organizations_url":"https://api.github.com/users/neoeno/orgs","repos_url":"https://api.github.com/users/neoeno/repos","events_url":"https://api.github.com/users/neoeno/events{/privacy}","received_events_url":"https://api.github.com/users/neoeno/received_events","type":"User","site_admin":false},"body":"__This commit branches off of #116, so [this diff](https://github.com/moneyadviceservice/cms/compare/popular_links...previous_next_article) is probably easier to follow.__\r\n\r\nSee moneyadviceservice/frontend#857.\r\n\r\nExposes the next and previous posts in the article's first category through the article JSON response.","created_at":"2014-12-23T15:46:01Z","updated_at":"2015-01-05T11:19:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/moneyadviceservice/cms/pulls/120/commits","review_comments_url":"https://api.github.com/repos/moneyadviceservice/cms/pulls/120/comments","review_comment_url":"https://api.github.com/repos/moneyadviceservice/cms/pulls/comments/{number}","comments_url":"https://api.github.com/repos/moneyadviceservice/cms/issues/120/comments","statuses_url":"https://api.github.com/repos/moneyadviceservice/cms/statuses/24ae31938a3a09f4cb504b4b8208c2105f9e7050","head":{"label":"moneyadviceservice:previous_next_article","ref":"previous_next_article","sha":"24ae31938a3a09f4cb504b4b8208c2105f9e7050","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":21238354,"name":"cms","full_name":"moneyadviceservice/cms","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/cms","description":"The MAS CMS","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/cms","forks_url":"https://api.github.com/repos/moneyadviceservice/cms/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/cms/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/cms/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/cms/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/cms/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/cms/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/cms/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/cms/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/cms/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/cms/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/cms/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/cms/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/cms/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/cms/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/cms/issues/comments/{number}","contents_url":"https://api.github.com/repos/moneyadviceservice/cms/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/cms/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/cms/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/cms/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/cms/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/cms/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/cms/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/cms/releases{/id}","created_at":"2014-06-26T11:26:25Z","updated_at":"2014-12-30T11:56:31Z","pushed_at":"2015-01-05T11:14:35Z","git_url":"git://github.com/moneyadviceservice/cms.git","ssh_url":"git@github.com:moneyadviceservice/cms.git","clone_url":"https://github.com/moneyadviceservice/cms.git","svn_url":"https://github.com/moneyadviceservice/cms","homepage":null,"size":10988,"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":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"moneyadviceservice:master","ref":"master","sha":"5f91ed696392c6e155662e7946946d88b559a0bf","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":21238354,"name":"cms","full_name":"moneyadviceservice/cms","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/cms","description":"The MAS CMS","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/cms","forks_url":"https://api.github.com/repos/moneyadviceservice/cms/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/cms/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/cms/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/cms/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/cms/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/cms/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/cms/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/cms/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/cms/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/cms/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/cms/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/cms/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/cms/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/cms/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/cms/issues/comments/{number}","contents_url":"https://api.github.com/repos/moneyadviceservice/cms/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/cms/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/cms/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/cms/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/cms/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/cms/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/cms/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/cms/releases{/id}","created_at":"2014-06-26T11:26:25Z","updated_at":"2014-12-30T11:56:31Z","pushed_at":"2015-01-05T11:14:35Z","git_url":"git://github.com/moneyadviceservice/cms.git","ssh_url":"git@github.com:moneyadviceservice/cms.git","clone_url":"https://github.com/moneyadviceservice/cms.git","svn_url":"https://github.com/moneyadviceservice/cms","homepage":null,"size":10988,"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":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/moneyadviceservice/cms/pulls/120"},"html":{"href":"https://github.com/moneyadviceservice/cms/pull/120"},"issue":{"href":"https://api.github.com/repos/moneyadviceservice/cms/issues/120"},"comments":{"href":"https://api.github.com/repos/moneyadviceservice/cms/issues/120/comments"},"review_comments":{"href":"https://api.github.com/repos/moneyadviceservice/cms/pulls/120/comments"},"review_comment":{"href":"https://api.github.com/repos/moneyadviceservice/cms/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/moneyadviceservice/cms/pulls/120/commits"},"statuses":{"href":"https://api.github.com/repos/moneyadviceservice/cms/statuses/24ae31938a3a09f4cb504b4b8208c2105f9e7050"}}}}