{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/rummager/pulls/comments/36961537","id":36961537,"diff_hunk":"@@ -43,6 +43,26 @@ def stub_index(name)\n     index\n   end\n \n+  context \"#prepare_response\" do\n+    should \"map an empty response\" do\n+      fetcher = FacetExampleFetcher.new(@index, {}, {}, @builder)\n+\n+      response = fetcher.send(:prepare_response, [], [])\n+\n+      assert_equal response, {}\n+    end\n+\n+    should \"map a response to facets without fields\" do\n+      fetcher = FacetExampleFetcher.new(@index, {}, {}, @builder)\n+      slugs = ['yolo']\n+      response_list = [{ 'hits' => { 'total' => 1, 'hits' => [ { 'slug' => 'yolo' }]}}]","path":"test/unit/facet_example_fetcher_test.rb","position":null,"original_position":16,"commit_id":"90e207abf9ed4e310d9445276ee00ac0b0395816","original_commit_id":"1d59fa36757306b20cf7c9dc32b810cdc0c90e5a","user":{"login":"tijmenb","id":233676,"avatar_url":"https://avatars.githubusercontent.com/u/233676?v=3","gravatar_id":"","url":"https://api.github.com/users/tijmenb","html_url":"https://github.com/tijmenb","followers_url":"https://api.github.com/users/tijmenb/followers","following_url":"https://api.github.com/users/tijmenb/following{/other_user}","gists_url":"https://api.github.com/users/tijmenb/gists{/gist_id}","starred_url":"https://api.github.com/users/tijmenb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tijmenb/subscriptions","organizations_url":"https://api.github.com/users/tijmenb/orgs","repos_url":"https://api.github.com/users/tijmenb/repos","events_url":"https://api.github.com/users/tijmenb/events{/privacy}","received_events_url":"https://api.github.com/users/tijmenb/received_events","type":"User","site_admin":false},"body":"Good point - updated.","created_at":"2015-08-13T10:44:58Z","updated_at":"2015-08-13T10:44:58Z","html_url":"https://github.com/alphagov/rummager/pull/490#discussion_r36961537","pull_request_url":"https://api.github.com/repos/alphagov/rummager/pulls/490","_links":{"self":{"href":"https://api.github.com/repos/alphagov/rummager/pulls/comments/36961537"},"html":{"href":"https://github.com/alphagov/rummager/pull/490#discussion_r36961537"},"pull_request":{"href":"https://api.github.com/repos/alphagov/rummager/pulls/490"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/rummager/pulls/490","id":42331849,"html_url":"https://github.com/alphagov/rummager/pull/490","diff_url":"https://github.com/alphagov/rummager/pull/490.diff","patch_url":"https://github.com/alphagov/rummager/pull/490.patch","issue_url":"https://api.github.com/repos/alphagov/rummager/issues/490","number":490,"state":"open","locked":false,"title":"Fix bug in facet example fetchers","user":{"login":"tijmenb","id":233676,"avatar_url":"https://avatars.githubusercontent.com/u/233676?v=3","gravatar_id":"","url":"https://api.github.com/users/tijmenb","html_url":"https://github.com/tijmenb","followers_url":"https://api.github.com/users/tijmenb/followers","following_url":"https://api.github.com/users/tijmenb/following{/other_user}","gists_url":"https://api.github.com/users/tijmenb/gists{/gist_id}","starred_url":"https://api.github.com/users/tijmenb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tijmenb/subscriptions","organizations_url":"https://api.github.com/users/tijmenb/orgs","repos_url":"https://api.github.com/users/tijmenb/repos","events_url":"https://api.github.com/users/tijmenb/events{/privacy}","received_events_url":"https://api.github.com/users/tijmenb/received_events","type":"User","site_admin":false},"body":"In some cases, elasticsearch's `fields` will be empty. That causes exceptions.\r\n\r\nIt seems very hard to reproduce this in the tests, so we had to extract a method and test it in isolation. This is not nice, but better than no tests.\r\n\r\ncc @rboulton ","created_at":"2015-08-13T09:45:05Z","updated_at":"2015-08-13T10:44:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0f2038e68949417766c54befde536001c75f0e9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/rummager/pulls/490/commits","review_comments_url":"https://api.github.com/repos/alphagov/rummager/pulls/490/comments","review_comment_url":"https://api.github.com/repos/alphagov/rummager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/rummager/issues/490/comments","statuses_url":"https://api.github.com/repos/alphagov/rummager/statuses/90e207abf9ed4e310d9445276ee00ac0b0395816","head":{"label":"alphagov:fix-facet-exception","ref":"fix-facet-exception","sha":"90e207abf9ed4e310d9445276ee00ac0b0395816","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":2686767,"name":"rummager","full_name":"alphagov/rummager","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/rummager","description":"Rummager is the internal GOV.UK API for search.","fork":false,"url":"https://api.github.com/repos/alphagov/rummager","forks_url":"https://api.github.com/repos/alphagov/rummager/forks","keys_url":"https://api.github.com/repos/alphagov/rummager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/rummager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/rummager/teams","hooks_url":"https://api.github.com/repos/alphagov/rummager/hooks","issue_events_url":"https://api.github.com/repos/alphagov/rummager/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/rummager/events","assignees_url":"https://api.github.com/repos/alphagov/rummager/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/rummager/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/rummager/tags","blobs_url":"https://api.github.com/repos/alphagov/rummager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/rummager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/rummager/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/rummager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/rummager/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/rummager/languages","stargazers_url":"https://api.github.com/repos/alphagov/rummager/stargazers","contributors_url":"https://api.github.com/repos/alphagov/rummager/contributors","subscribers_url":"https://api.github.com/repos/alphagov/rummager/subscribers","subscription_url":"https://api.github.com/repos/alphagov/rummager/subscription","commits_url":"https://api.github.com/repos/alphagov/rummager/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/rummager/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/rummager/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/rummager/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/rummager/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/rummager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/rummager/merges","archive_url":"https://api.github.com/repos/alphagov/rummager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/rummager/downloads","issues_url":"https://api.github.com/repos/alphagov/rummager/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/rummager/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/rummager/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/rummager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/rummager/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/rummager/releases{/id}","created_at":"2011-11-01T10:12:45Z","updated_at":"2015-07-28T14:13:07Z","pushed_at":"2015-08-13T10:44:36Z","git_url":"git://github.com/alphagov/rummager.git","ssh_url":"git@github.com:alphagov/rummager.git","clone_url":"https://github.com/alphagov/rummager.git","svn_url":"https://github.com/alphagov/rummager","homepage":"","size":10266,"stargazers_count":25,"watchers_count":25,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":3,"forks":7,"open_issues":3,"watchers":25,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"1661d2287f6497941c5977f1cd782f2089b902ac","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":2686767,"name":"rummager","full_name":"alphagov/rummager","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/rummager","description":"Rummager is the internal GOV.UK API for search.","fork":false,"url":"https://api.github.com/repos/alphagov/rummager","forks_url":"https://api.github.com/repos/alphagov/rummager/forks","keys_url":"https://api.github.com/repos/alphagov/rummager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/rummager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/rummager/teams","hooks_url":"https://api.github.com/repos/alphagov/rummager/hooks","issue_events_url":"https://api.github.com/repos/alphagov/rummager/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/rummager/events","assignees_url":"https://api.github.com/repos/alphagov/rummager/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/rummager/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/rummager/tags","blobs_url":"https://api.github.com/repos/alphagov/rummager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/rummager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/rummager/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/rummager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/rummager/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/rummager/languages","stargazers_url":"https://api.github.com/repos/alphagov/rummager/stargazers","contributors_url":"https://api.github.com/repos/alphagov/rummager/contributors","subscribers_url":"https://api.github.com/repos/alphagov/rummager/subscribers","subscription_url":"https://api.github.com/repos/alphagov/rummager/subscription","commits_url":"https://api.github.com/repos/alphagov/rummager/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/rummager/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/rummager/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/rummager/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/rummager/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/rummager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/rummager/merges","archive_url":"https://api.github.com/repos/alphagov/rummager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/rummager/downloads","issues_url":"https://api.github.com/repos/alphagov/rummager/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/rummager/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/rummager/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/rummager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/rummager/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/rummager/releases{/id}","created_at":"2011-11-01T10:12:45Z","updated_at":"2015-07-28T14:13:07Z","pushed_at":"2015-08-13T10:44:36Z","git_url":"git://github.com/alphagov/rummager.git","ssh_url":"git@github.com:alphagov/rummager.git","clone_url":"https://github.com/alphagov/rummager.git","svn_url":"https://github.com/alphagov/rummager","homepage":"","size":10266,"stargazers_count":25,"watchers_count":25,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":3,"forks":7,"open_issues":3,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/rummager/pulls/490"},"html":{"href":"https://github.com/alphagov/rummager/pull/490"},"issue":{"href":"https://api.github.com/repos/alphagov/rummager/issues/490"},"comments":{"href":"https://api.github.com/repos/alphagov/rummager/issues/490/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/rummager/pulls/490/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/rummager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/rummager/pulls/490/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/rummager/statuses/90e207abf9ed4e310d9445276ee00ac0b0395816"}}}}