{"action":"created","comment":{"url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/comments/38391758","id":38391758,"diff_hunk":"@@ -0,0 +1,54 @@\n+RSpec.describe CreateLocationDecorator, '.build' do\n+  let(:postcode) { 'BT7 3AP' }\n+  let(:search_limit) { 3 }\n+  let(:booking_location_id) { 222 }\n+  let(:booking_location) { double(id: booking_location_id) }\n+  let(:location_id) { 111 }\n+  let(:location) { double(id: location_id, booking_location_id: booking_location_id) }\n+  let(:nearest_locations) { double }\n+  let(:search_context) { double }\n+  let(:twilio_number) { double }\n+  let(:location_decorator) { double }\n+\n+  def create_decorator\n+    described_class.build(location: location,\n+                          postcode: postcode,\n+                          search_limit: search_limit)\n+  end\n+\n+  subject(:decorator) { create_decorator }\n+\n+  before do\n+    allow(Locations).to receive(:find).with(booking_location_id).and_return(booking_location)\n+    allow(Locations).to receive(:nearest_to_postcode).with(postcode, limit: search_limit).and_return(nearest_locations)\n+    allow(LocationSearchContext).to receive(:build).with(nearest_locations, location).and_return(search_context)\n+    allow(Switchboard).to receive(:lookup).with(location_id).and_return(twilio_number)\n+    expect(LocationDecorator).to receive(:new).with(\n+      location, booking_location: booking_location, search_context: search_context, twilio_number: twilio_number\n+    ).and_return(location_decorator)\n+  end\n+\n+  it { should eq(location_decorator) }\n+\n+  context 'without a seperate booking location' do\n+    let(:booking_location_id) { nil }\n+    let(:booking_location) { nil }\n+\n+    it 'does not retrieve the booking location' do\n+      expect(Locations).to_not receive(:find)\n+      create_decorator\n+    end\n+  end\n+\n+  context 'when the cab locator raises an exception' do","path":"spec/services/create_location_decorator_spec.rb","position":43,"original_position":43,"commit_id":"a813116d56a0c8be43700bb7e960d881d1e5cf4d","original_commit_id":"a813116d56a0c8be43700bb7e960d881d1e5cf4d","user":{"login":"andrewgarner","id":2715,"avatar_url":"https://avatars.githubusercontent.com/u/2715?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewgarner","html_url":"https://github.com/andrewgarner","followers_url":"https://api.github.com/users/andrewgarner/followers","following_url":"https://api.github.com/users/andrewgarner/following{/other_user}","gists_url":"https://api.github.com/users/andrewgarner/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewgarner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewgarner/subscriptions","organizations_url":"https://api.github.com/users/andrewgarner/orgs","repos_url":"https://api.github.com/users/andrewgarner/repos","events_url":"https://api.github.com/users/andrewgarner/events{/privacy}","received_events_url":"https://api.github.com/users/andrewgarner/received_events","type":"User","site_admin":false},"body":"`cab locator` isn't a domain term. How about `when finding locations nearest to a postcode raises an exception`?","created_at":"2015-09-01T07:23:11Z","updated_at":"2015-09-01T07:23:11Z","html_url":"https://github.com/guidance-guarantee-programme/pension_guidance/pull/320#discussion_r38391758","pull_request_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/320","_links":{"self":{"href":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/comments/38391758"},"html":{"href":"https://github.com/guidance-guarantee-programme/pension_guidance/pull/320#discussion_r38391758"},"pull_request":{"href":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/320"}}},"pull_request":{"url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/320","id":43416929,"html_url":"https://github.com/guidance-guarantee-programme/pension_guidance/pull/320","diff_url":"https://github.com/guidance-guarantee-programme/pension_guidance/pull/320.diff","patch_url":"https://github.com/guidance-guarantee-programme/pension_guidance/pull/320.patch","issue_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues/320","number":320,"state":"open","locked":false,"title":"Refactor LocationDecorator construction","user":{"login":"stevenwilkin","id":45121,"avatar_url":"https://avatars.githubusercontent.com/u/45121?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenwilkin","html_url":"https://github.com/stevenwilkin","followers_url":"https://api.github.com/users/stevenwilkin/followers","following_url":"https://api.github.com/users/stevenwilkin/following{/other_user}","gists_url":"https://api.github.com/users/stevenwilkin/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenwilkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenwilkin/subscriptions","organizations_url":"https://api.github.com/users/stevenwilkin/orgs","repos_url":"https://api.github.com/users/stevenwilkin/repos","events_url":"https://api.github.com/users/stevenwilkin/events{/privacy}","received_events_url":"https://api.github.com/users/stevenwilkin/received_events","type":"User","site_admin":false},"body":"This extracts logic from the controller and decorator into more easily testable locations. Introduces even more small parts to the system but should hopefully be easier to understand and modify in the future.","created_at":"2015-08-26T15:38:12Z","updated_at":"2015-09-01T07:23:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68c71c361c625b4c05aa5e574eb1d6928989457b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/320/commits","review_comments_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/320/comments","review_comment_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues/320/comments","statuses_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/statuses/a813116d56a0c8be43700bb7e960d881d1e5cf4d","head":{"label":"guidance-guarantee-programme:refactor-location-decorator-construction","ref":"refactor-location-decorator-construction","sha":"a813116d56a0c8be43700bb7e960d881d1e5cf4d","user":{"login":"guidance-guarantee-programme","id":8751528,"avatar_url":"https://avatars.githubusercontent.com/u/8751528?v=3","gravatar_id":"","url":"https://api.github.com/users/guidance-guarantee-programme","html_url":"https://github.com/guidance-guarantee-programme","followers_url":"https://api.github.com/users/guidance-guarantee-programme/followers","following_url":"https://api.github.com/users/guidance-guarantee-programme/following{/other_user}","gists_url":"https://api.github.com/users/guidance-guarantee-programme/gists{/gist_id}","starred_url":"https://api.github.com/users/guidance-guarantee-programme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidance-guarantee-programme/subscriptions","organizations_url":"https://api.github.com/users/guidance-guarantee-programme/orgs","repos_url":"https://api.github.com/users/guidance-guarantee-programme/repos","events_url":"https://api.github.com/users/guidance-guarantee-programme/events{/privacy}","received_events_url":"https://api.github.com/users/guidance-guarantee-programme/received_events","type":"Organization","site_admin":false},"repo":{"id":26530409,"name":"pension_guidance","full_name":"guidance-guarantee-programme/pension_guidance","owner":{"login":"guidance-guarantee-programme","id":8751528,"avatar_url":"https://avatars.githubusercontent.com/u/8751528?v=3","gravatar_id":"","url":"https://api.github.com/users/guidance-guarantee-programme","html_url":"https://github.com/guidance-guarantee-programme","followers_url":"https://api.github.com/users/guidance-guarantee-programme/followers","following_url":"https://api.github.com/users/guidance-guarantee-programme/following{/other_user}","gists_url":"https://api.github.com/users/guidance-guarantee-programme/gists{/gist_id}","starred_url":"https://api.github.com/users/guidance-guarantee-programme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidance-guarantee-programme/subscriptions","organizations_url":"https://api.github.com/users/guidance-guarantee-programme/orgs","repos_url":"https://api.github.com/users/guidance-guarantee-programme/repos","events_url":"https://api.github.com/users/guidance-guarantee-programme/events{/privacy}","received_events_url":"https://api.github.com/users/guidance-guarantee-programme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guidance-guarantee-programme/pension_guidance","description":"Pension guidance from Pension Wise.","fork":false,"url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance","forks_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/forks","keys_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/teams","hooks_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/hooks","issue_events_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues/events{/number}","events_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/events","assignees_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/assignees{/user}","branches_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/branches{/branch}","tags_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/tags","blobs_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/refs{/sha}","trees_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/statuses/{sha}","languages_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/languages","stargazers_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/stargazers","contributors_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/contributors","subscribers_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/subscribers","subscription_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/subscription","commits_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/commits{/sha}","git_commits_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/commits{/sha}","comments_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/comments{/number}","issue_comment_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues/comments{/number}","contents_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/contents/{+path}","compare_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/merges","archive_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/downloads","issues_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues{/number}","pulls_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls{/number}","milestones_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/milestones{/number}","notifications_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/labels{/name}","releases_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/releases{/id}","created_at":"2014-11-12T10:16:42Z","updated_at":"2015-08-12T14:57:57Z","pushed_at":"2015-08-28T15:22:45Z","git_url":"git://github.com/guidance-guarantee-programme/pension_guidance.git","ssh_url":"git@github.com:guidance-guarantee-programme/pension_guidance.git","clone_url":"https://github.com/guidance-guarantee-programme/pension_guidance.git","svn_url":"https://github.com/guidance-guarantee-programme/pension_guidance","homepage":"https://www.pensionwise.gov.uk","size":15480,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"guidance-guarantee-programme:master","ref":"master","sha":"da675ad7e2dc6abe707e436f5d752c20c5c9f932","user":{"login":"guidance-guarantee-programme","id":8751528,"avatar_url":"https://avatars.githubusercontent.com/u/8751528?v=3","gravatar_id":"","url":"https://api.github.com/users/guidance-guarantee-programme","html_url":"https://github.com/guidance-guarantee-programme","followers_url":"https://api.github.com/users/guidance-guarantee-programme/followers","following_url":"https://api.github.com/users/guidance-guarantee-programme/following{/other_user}","gists_url":"https://api.github.com/users/guidance-guarantee-programme/gists{/gist_id}","starred_url":"https://api.github.com/users/guidance-guarantee-programme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidance-guarantee-programme/subscriptions","organizations_url":"https://api.github.com/users/guidance-guarantee-programme/orgs","repos_url":"https://api.github.com/users/guidance-guarantee-programme/repos","events_url":"https://api.github.com/users/guidance-guarantee-programme/events{/privacy}","received_events_url":"https://api.github.com/users/guidance-guarantee-programme/received_events","type":"Organization","site_admin":false},"repo":{"id":26530409,"name":"pension_guidance","full_name":"guidance-guarantee-programme/pension_guidance","owner":{"login":"guidance-guarantee-programme","id":8751528,"avatar_url":"https://avatars.githubusercontent.com/u/8751528?v=3","gravatar_id":"","url":"https://api.github.com/users/guidance-guarantee-programme","html_url":"https://github.com/guidance-guarantee-programme","followers_url":"https://api.github.com/users/guidance-guarantee-programme/followers","following_url":"https://api.github.com/users/guidance-guarantee-programme/following{/other_user}","gists_url":"https://api.github.com/users/guidance-guarantee-programme/gists{/gist_id}","starred_url":"https://api.github.com/users/guidance-guarantee-programme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidance-guarantee-programme/subscriptions","organizations_url":"https://api.github.com/users/guidance-guarantee-programme/orgs","repos_url":"https://api.github.com/users/guidance-guarantee-programme/repos","events_url":"https://api.github.com/users/guidance-guarantee-programme/events{/privacy}","received_events_url":"https://api.github.com/users/guidance-guarantee-programme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guidance-guarantee-programme/pension_guidance","description":"Pension guidance from Pension Wise.","fork":false,"url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance","forks_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/forks","keys_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/teams","hooks_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/hooks","issue_events_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues/events{/number}","events_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/events","assignees_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/assignees{/user}","branches_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/branches{/branch}","tags_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/tags","blobs_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/refs{/sha}","trees_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/statuses/{sha}","languages_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/languages","stargazers_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/stargazers","contributors_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/contributors","subscribers_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/subscribers","subscription_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/subscription","commits_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/commits{/sha}","git_commits_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/git/commits{/sha}","comments_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/comments{/number}","issue_comment_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues/comments{/number}","contents_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/contents/{+path}","compare_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/merges","archive_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/downloads","issues_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues{/number}","pulls_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls{/number}","milestones_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/milestones{/number}","notifications_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/labels{/name}","releases_url":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/releases{/id}","created_at":"2014-11-12T10:16:42Z","updated_at":"2015-08-12T14:57:57Z","pushed_at":"2015-08-28T15:22:45Z","git_url":"git://github.com/guidance-guarantee-programme/pension_guidance.git","ssh_url":"git@github.com:guidance-guarantee-programme/pension_guidance.git","clone_url":"https://github.com/guidance-guarantee-programme/pension_guidance.git","svn_url":"https://github.com/guidance-guarantee-programme/pension_guidance","homepage":"https://www.pensionwise.gov.uk","size":15480,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/320"},"html":{"href":"https://github.com/guidance-guarantee-programme/pension_guidance/pull/320"},"issue":{"href":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues/320"},"comments":{"href":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/issues/320/comments"},"review_comments":{"href":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/320/comments"},"review_comment":{"href":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/pulls/320/commits"},"statuses":{"href":"https://api.github.com/repos/guidance-guarantee-programme/pension_guidance/statuses/a813116d56a0c8be43700bb7e960d881d1e5cf4d"}}}}