{"action":"created","comment":{"url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/comments/86570705","pull_request_review_id":7224308,"id":86570705,"diff_hunk":"@@ -36,6 +36,91 @@ def result\n     end\n   end\n \n+  describe '#without_appointments' do\n+    let(:guider) do\n+      create(:user)\n+    end\n+\n+    let!(:slot) do\n+      create(\n+        :bookable_slot,\n+        guider: guider,\n+        start_at: make_time(10, 30),\n+        end_at: make_time(11, 30)\n+      )\n+    end\n+\n+    subject do\n+      BookableSlot.without_appointments\n+    end\n+\n+    it 'excludes slots with appointments' do\n+      create(\n+        :appointment,\n+        guider: guider,\n+        start_at: make_time(10, 30),\n+        end_at: make_time(11, 30),\n+        status: :pending\n+      )\n+      expect(subject).to_not include slot\n+    end\n+\n+    it 'includes slots with cancelled appointments' do\n+      create(\n+        :appointment,\n+        guider: guider,\n+        start_at: make_time(10, 30),\n+        end_at: make_time(11, 30),\n+        status: :cancelled_by_customer\n+      )\n+      expect(subject).to include slot\n+    end\n+  end\n+\n+  describe '#without_holidays' do\n+    let(:guider) do\n+      create(:user)\n+    end\n+\n+    let!(:slot) do\n+      create(\n+        :bookable_slot,\n+        guider: guider,\n+        start_at: make_time(10, 30),\n+        end_at: make_time(11, 30)\n+      )\n+    end\n+\n+    subject do\n+      BookableSlot.without_holidays\n+    end\n+\n+    it 'does not exclude everything' do\n+      expect(subject).to include slot\n+    end\n+\n+    it 'excludes slots with bank holidays' do\n+      create(\n+        :holiday,\n+        user: nil,\n+        start_at: make_time(6, 30),\n+        end_at: make_time(18, 30)\n+      )\n+      expect(subject).to_not include slot\n+    end\n+\n+    it 'excludes slots with user holidays' do\n+      create(\n+        :holiday,\n+        user: guider,\n+        start_at: make_time(5, 30),\n+        end_at: make_time(20, 30)\n+      )\n+","path":"spec/models/bookable_slot_spec.rb","position":84,"original_position":84,"commit_id":"1228f59734d8f782022db31b894620ffb7c810b6","original_commit_id":"897bb403ce4ff93a52c7e52ed2a170a3ffed0e2b","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":"Remove this line or add one elsewhere in this same style (actually my preference) to separate the setup from the assertion(s).","created_at":"2016-11-04T15:34:24Z","updated_at":"2016-11-04T15:34:25Z","html_url":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner/pull/182#discussion_r86570705","pull_request_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/182","_links":{"self":{"href":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/comments/86570705"},"html":{"href":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner/pull/182#discussion_r86570705"},"pull_request":{"href":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/182"}}},"pull_request":{"url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/182","id":92197202,"html_url":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner/pull/182","diff_url":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner/pull/182.diff","patch_url":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner/pull/182.patch","issue_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues/182","number":182,"state":"open","locked":false,"title":"Resource managers can generate a utilisation report","user":{"login":"AndrewVos","id":363618,"avatar_url":"https://avatars.githubusercontent.com/u/363618?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewVos","html_url":"https://github.com/AndrewVos","followers_url":"https://api.github.com/users/AndrewVos/followers","following_url":"https://api.github.com/users/AndrewVos/following{/other_user}","gists_url":"https://api.github.com/users/AndrewVos/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewVos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewVos/subscriptions","organizations_url":"https://api.github.com/users/AndrewVos/orgs","repos_url":"https://api.github.com/users/AndrewVos/repos","events_url":"https://api.github.com/users/AndrewVos/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewVos/received_events","type":"User","site_admin":false},"body":"![https://dl.dropboxusercontent.com/u/1207191/screenshots/screenshot-04-11-2016-10-38-00-vae4EZei.png](https://dl.dropboxusercontent.com/u/1207191/screenshots/screenshot-04-11-2016-10-38-00-vae4EZei.png)","created_at":"2016-11-03T17:02:30Z","updated_at":"2016-11-04T15:34:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"718d34f519cec944f39579bf3294a7b5e6bfeb5f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/182/commits","review_comments_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/182/comments","review_comment_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues/182/comments","statuses_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/statuses/1228f59734d8f782022db31b894620ffb7c810b6","head":{"label":"guidance-guarantee-programme:utilisation-report","ref":"utilisation-report","sha":"1228f59734d8f782022db31b894620ffb7c810b6","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":68911039,"name":"telephone_appointment_planner","full_name":"guidance-guarantee-programme/telephone_appointment_planner","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/telephone_appointment_planner","description":"Telephone Appointment Planner","fork":false,"url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner","forks_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/forks","keys_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/teams","hooks_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/hooks","issue_events_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues/events{/number}","events_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/events","assignees_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/assignees{/user}","branches_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/branches{/branch}","tags_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/tags","blobs_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/refs{/sha}","trees_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/statuses/{sha}","languages_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/languages","stargazers_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/stargazers","contributors_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/contributors","subscribers_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/subscribers","subscription_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/subscription","commits_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/commits{/sha}","git_commits_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/commits{/sha}","comments_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/comments{/number}","issue_comment_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues/comments{/number}","contents_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/contents/{+path}","compare_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/merges","archive_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/downloads","issues_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues{/number}","pulls_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls{/number}","milestones_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/milestones{/number}","notifications_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/labels{/name}","releases_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/releases{/id}","deployments_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/deployments","created_at":"2016-09-22T10:33:15Z","updated_at":"2016-10-22T09:32:05Z","pushed_at":"2016-11-04T15:34:07Z","git_url":"git://github.com/guidance-guarantee-programme/telephone_appointment_planner.git","ssh_url":"git@github.com:guidance-guarantee-programme/telephone_appointment_planner.git","clone_url":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner.git","svn_url":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner","homepage":null,"size":558,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"guidance-guarantee-programme:master","ref":"master","sha":"c5ed253074524734381cf891abf918cbfbd6f5cd","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":68911039,"name":"telephone_appointment_planner","full_name":"guidance-guarantee-programme/telephone_appointment_planner","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/telephone_appointment_planner","description":"Telephone Appointment Planner","fork":false,"url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner","forks_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/forks","keys_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/teams","hooks_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/hooks","issue_events_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues/events{/number}","events_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/events","assignees_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/assignees{/user}","branches_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/branches{/branch}","tags_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/tags","blobs_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/refs{/sha}","trees_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/statuses/{sha}","languages_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/languages","stargazers_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/stargazers","contributors_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/contributors","subscribers_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/subscribers","subscription_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/subscription","commits_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/commits{/sha}","git_commits_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/git/commits{/sha}","comments_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/comments{/number}","issue_comment_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues/comments{/number}","contents_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/contents/{+path}","compare_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/merges","archive_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/downloads","issues_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues{/number}","pulls_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls{/number}","milestones_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/milestones{/number}","notifications_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/labels{/name}","releases_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/releases{/id}","deployments_url":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/deployments","created_at":"2016-09-22T10:33:15Z","updated_at":"2016-10-22T09:32:05Z","pushed_at":"2016-11-04T15:34:07Z","git_url":"git://github.com/guidance-guarantee-programme/telephone_appointment_planner.git","ssh_url":"git@github.com:guidance-guarantee-programme/telephone_appointment_planner.git","clone_url":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner.git","svn_url":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner","homepage":null,"size":558,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/182"},"html":{"href":"https://github.com/guidance-guarantee-programme/telephone_appointment_planner/pull/182"},"issue":{"href":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues/182"},"comments":{"href":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/issues/182/comments"},"review_comments":{"href":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/182/comments"},"review_comment":{"href":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/pulls/182/commits"},"statuses":{"href":"https://api.github.com/repos/guidance-guarantee-programme/telephone_appointment_planner/statuses/1228f59734d8f782022db31b894620ffb7c810b6"}}}}
{"actor":{"display_login":"benlovell"}}