{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/comments/90838712","pull_request_review_id":11352557,"id":90838712,"diff_hunk":"@@ -31,29 +31,22 @@\n   end\n \n   context 'Content Items' do\n-    it 'imports all content items for the organisation' do\n+    before do\n       allow(HTTParty).to receive(:get).and_return(two_content_items_response)\n       Importers::Organisation.new('a-slug').run\n-      organisation = Organisation.find_by(slug: 'a-slug')\n-\n-      expect(organisation.content_items.count).to eq(2)\n+      @organisation = Organisation.find_by(slug: 'a-slug')","path":"spec/models/importers/organisation_spec.rb","position":24,"original_position":11,"commit_id":"f5d223ffc520b661f71e26a5187dbe170d4f88a1","original_commit_id":"d187f8fb5b51c740fa4a9094ffd5f36d65f16777","user":{"login":"pmanrubia","id":227328,"avatar_url":"https://avatars.githubusercontent.com/u/227328?v=3","gravatar_id":"","url":"https://api.github.com/users/pmanrubia","html_url":"https://github.com/pmanrubia","followers_url":"https://api.github.com/users/pmanrubia/followers","following_url":"https://api.github.com/users/pmanrubia/following{/other_user}","gists_url":"https://api.github.com/users/pmanrubia/gists{/gist_id}","starred_url":"https://api.github.com/users/pmanrubia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmanrubia/subscriptions","organizations_url":"https://api.github.com/users/pmanrubia/orgs","repos_url":"https://api.github.com/users/pmanrubia/repos","events_url":"https://api.github.com/users/pmanrubia/events{/privacy}","received_events_url":"https://api.github.com/users/pmanrubia/received_events","type":"User","site_admin":false},"body":"\r\n1. Duplication in the code that exercises the code is accepted if it increases readability. I think this is the case\r\n2. It is also easier to add extra setup code for the test (if we use a before block we can't do it per test)\r\n\r\nI would go with something like this:\r\n\r\n```ruby\r\nbefore { allow(HTTParty).to receive(:get).and_return(two_content_items_response) } \r\nlet(:organisation) { organisation = Organisation.find_by(slug: 'a-slug') }\r\n\r\nit 'imports a `content_id` for every content item' do\r\n  Importers::Organisation.new('a-slug').run\r\n\r\n  content_ids = organisation.content_items.pluck(:content_id)\r\n  expect(content_ids).to eq(%w(content-id-1 content-id-2))\r\nend\r\n```\r\n\r\n","created_at":"2016-12-05T10:36:58Z","updated_at":"2016-12-05T10:40:13Z","html_url":"https://github.com/alphagov/content-performance-manager/pull/14#discussion_r90838712","pull_request_url":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/comments/90838712"},"html":{"href":"https://github.com/alphagov/content-performance-manager/pull/14#discussion_r90838712"},"pull_request":{"href":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/14","id":96080791,"html_url":"https://github.com/alphagov/content-performance-manager/pull/14","diff_url":"https://github.com/alphagov/content-performance-manager/pull/14.diff","patch_url":"https://github.com/alphagov/content-performance-manager/pull/14.patch","issue_url":"https://api.github.com/repos/alphagov/content-performance-manager/issues/14","number":14,"state":"open","locked":false,"title":"Show URL for a departments content item","user":{"login":"ikennaokpala","id":84896,"avatar_url":"https://avatars.githubusercontent.com/u/84896?v=3","gravatar_id":"","url":"https://api.github.com/users/ikennaokpala","html_url":"https://github.com/ikennaokpala","followers_url":"https://api.github.com/users/ikennaokpala/followers","following_url":"https://api.github.com/users/ikennaokpala/following{/other_user}","gists_url":"https://api.github.com/users/ikennaokpala/gists{/gist_id}","starred_url":"https://api.github.com/users/ikennaokpala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikennaokpala/subscriptions","organizations_url":"https://api.github.com/users/ikennaokpala/orgs","repos_url":"https://api.github.com/users/ikennaokpala/repos","events_url":"https://api.github.com/users/ikennaokpala/events{/privacy}","received_events_url":"https://api.github.com/users/ikennaokpala/received_events","type":"User","site_admin":false},"body":"Related #13 \r\n\r\n[Trello card](https://trello.com/c/SgGrXnx9/71-collect-url-for-a-departments-content)\r\n\r\n## Description \r\n\r\nFor each department’s content item, content designers want to visit the url of a\r\ncontent item.\r\n\r\nThe link column/attribute has been added to the content_item(s).\r\nThis attribute’s value is obtained via this request to the search api.\r\n\r\nA new method (i.e url) has been introduced that concatenates https://gov.uk and\r\nthe content item’s path.\r\n\r\nThis is then used to populate a Content URL column.\r\n","created_at":"2016-12-01T12:36:02Z","updated_at":"2016-12-05T10:47:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c888312a1368490d5695b94052c694819440641","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/14/commits","review_comments_url":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/14/comments","review_comment_url":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/content-performance-manager/issues/14/comments","statuses_url":"https://api.github.com/repos/alphagov/content-performance-manager/statuses/f5d223ffc520b661f71e26a5187dbe170d4f88a1","head":{"label":"alphagov:story/content-urls-for-department","ref":"story/content-urls-for-department","sha":"f5d223ffc520b661f71e26a5187dbe170d4f88a1","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":73927580,"name":"content-performance-manager","full_name":"alphagov/content-performance-manager","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/content-performance-manager","description":"Content Operating Model prototype","fork":false,"url":"https://api.github.com/repos/alphagov/content-performance-manager","forks_url":"https://api.github.com/repos/alphagov/content-performance-manager/forks","keys_url":"https://api.github.com/repos/alphagov/content-performance-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/content-performance-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/content-performance-manager/teams","hooks_url":"https://api.github.com/repos/alphagov/content-performance-manager/hooks","issue_events_url":"https://api.github.com/repos/alphagov/content-performance-manager/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/content-performance-manager/events","assignees_url":"https://api.github.com/repos/alphagov/content-performance-manager/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/content-performance-manager/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/content-performance-manager/tags","blobs_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/content-performance-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/content-performance-manager/languages","stargazers_url":"https://api.github.com/repos/alphagov/content-performance-manager/stargazers","contributors_url":"https://api.github.com/repos/alphagov/content-performance-manager/contributors","subscribers_url":"https://api.github.com/repos/alphagov/content-performance-manager/subscribers","subscription_url":"https://api.github.com/repos/alphagov/content-performance-manager/subscription","commits_url":"https://api.github.com/repos/alphagov/content-performance-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/content-performance-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/content-performance-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/content-performance-manager/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/content-performance-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/content-performance-manager/merges","archive_url":"https://api.github.com/repos/alphagov/content-performance-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/content-performance-manager/downloads","issues_url":"https://api.github.com/repos/alphagov/content-performance-manager/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/content-performance-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/content-performance-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/content-performance-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/content-performance-manager/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/content-performance-manager/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/content-performance-manager/deployments","created_at":"2016-11-16T14:22:38Z","updated_at":"2016-11-29T14:51:32Z","pushed_at":"2016-12-02T16:43:56Z","git_url":"git://github.com/alphagov/content-performance-manager.git","ssh_url":"git@github.com:alphagov/content-performance-manager.git","clone_url":"https://github.com/alphagov/content-performance-manager.git","svn_url":"https://github.com/alphagov/content-performance-manager","homepage":null,"size":184,"stargazers_count":2,"watchers_count":2,"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":2,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"3a4debd3191f1c698ff0d510132f5ca304210496","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":73927580,"name":"content-performance-manager","full_name":"alphagov/content-performance-manager","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/content-performance-manager","description":"Content Operating Model prototype","fork":false,"url":"https://api.github.com/repos/alphagov/content-performance-manager","forks_url":"https://api.github.com/repos/alphagov/content-performance-manager/forks","keys_url":"https://api.github.com/repos/alphagov/content-performance-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/content-performance-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/content-performance-manager/teams","hooks_url":"https://api.github.com/repos/alphagov/content-performance-manager/hooks","issue_events_url":"https://api.github.com/repos/alphagov/content-performance-manager/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/content-performance-manager/events","assignees_url":"https://api.github.com/repos/alphagov/content-performance-manager/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/content-performance-manager/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/content-performance-manager/tags","blobs_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/content-performance-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/content-performance-manager/languages","stargazers_url":"https://api.github.com/repos/alphagov/content-performance-manager/stargazers","contributors_url":"https://api.github.com/repos/alphagov/content-performance-manager/contributors","subscribers_url":"https://api.github.com/repos/alphagov/content-performance-manager/subscribers","subscription_url":"https://api.github.com/repos/alphagov/content-performance-manager/subscription","commits_url":"https://api.github.com/repos/alphagov/content-performance-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/content-performance-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/content-performance-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/content-performance-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/content-performance-manager/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/content-performance-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/content-performance-manager/merges","archive_url":"https://api.github.com/repos/alphagov/content-performance-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/content-performance-manager/downloads","issues_url":"https://api.github.com/repos/alphagov/content-performance-manager/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/content-performance-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/content-performance-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/content-performance-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/content-performance-manager/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/content-performance-manager/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/content-performance-manager/deployments","created_at":"2016-11-16T14:22:38Z","updated_at":"2016-11-29T14:51:32Z","pushed_at":"2016-12-02T16:43:56Z","git_url":"git://github.com/alphagov/content-performance-manager.git","ssh_url":"git@github.com:alphagov/content-performance-manager.git","clone_url":"https://github.com/alphagov/content-performance-manager.git","svn_url":"https://github.com/alphagov/content-performance-manager","homepage":null,"size":184,"stargazers_count":2,"watchers_count":2,"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":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/14"},"html":{"href":"https://github.com/alphagov/content-performance-manager/pull/14"},"issue":{"href":"https://api.github.com/repos/alphagov/content-performance-manager/issues/14"},"comments":{"href":"https://api.github.com/repos/alphagov/content-performance-manager/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/content-performance-manager/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/content-performance-manager/statuses/f5d223ffc520b661f71e26a5187dbe170d4f88a1"}}}}
{"actor":{"display_login":"pmanrubia"}}