{"action":"created","comment":{"url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments/46295441","id":46295441,"diff_hunk":"@@ -0,0 +1,142 @@\n+require 'till'\n+require 'timecop'\n+\n+describe Till do\n+\n+  let(:till) { described_class.new( { shopName: \"The Coffee Connection\",\n+                                      address: \"123 Lakeside Way\",\n+                                      phone: \"16503600708\",\n+                                      prices: { \"Cafe Latte\"=> 4.75, \"Flat White\"=> 4.75 }\n+                                     } ) }\n+\n+  let(:order) { double(:order, customers: [\"Jane\", \"John\"], \n+                               items: [\"Cafe Latte\", \"Cafe Latte\", \"Flat White\"],\n+                               table: 1 ) }\n+\n+  let(:amount_discount) { double(:discount, type: :amount, trigger: 10.00 , percent: 10.00) }\n+  let(:line_discount) { double(:discount, type: :line, line: \"Latte\", percent: 5.00) }\n+\n+  describe '#total' do\n+\n+    it 'calculates the amount due' do\n+      expect(till.total(order)).to eq( { amount_due: 15.48 } )\n+    end\n+\n+    context 'when amount discount is added' do\n+\n+      it 'calculates amount due - discount' do\n+        till.add_discount(amount_discount)\n+        expect(till.total(order)).to eq( { amount_due: 13.93 } )\n+      end\n+\n+      it 'shows discount on receipt' do\n+        till.add_discount(amount_discount)\n+        till.total(order)\n+        expect(till.take_payment(20.00)[:discount]).to eq(1.55)\n+      end\n+\n+    end\n+\n+    context 'when line discount is added' do\n+\n+      it 'calculates amount due - discount' do\n+        till.add_discount(line_discount)\n+        expect(till.total(order)).to eq( { amount_due: 15.00 } )\n+      end\n+\n+      it 'shows discount on receipt' do\n+        till.add_discount(line_discount)\n+        till.total(order)\n+        expect(till.take_payment(20.00)[:discount]).to eq(0.48)\n+      end\n+\n+    end\n+\n+  end\n+\n+  describe '#take_payment' do\n+\n+    before do\n+      till.total(order)\n+    end\n+\n+    it 'produces receipt with time' do\n+      Timecop.freeze(Time.local(2015, 10, 10, 8, 0))","path":"spec/till_spec.rb","position":64,"original_position":64,"commit_id":"c804493dfd5afaaa2b9a19eb65c149a6ad908154","original_commit_id":"c804493dfd5afaaa2b9a19eb65c149a6ad908154","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Rails/TimeZone: Do not use `Time.local` without zone. Use one of `Time.zone.local`, `Time.local.current`, `Time.local.in_time_zone`, `Time.local.utc`, `Time.local.getlocal`, `Time.local.iso8601`, `Time.local.jisx0301`, `Time.local.rfc3339`, `Time.local.to_i`, `Time.local.to_f` instead. (https://github.com/bbatsov/rails-style-guide#time, http://danilenko.org/2012/7/6/rails_timezones)","created_at":"2015-12-01T15:54:16Z","updated_at":"2015-12-01T15:54:16Z","html_url":"https://github.com/makersacademy/till_tech_test/pull/35#discussion_r46295441","pull_request_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments/46295441"},"html":{"href":"https://github.com/makersacademy/till_tech_test/pull/35#discussion_r46295441"},"pull_request":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/35","id":52275416,"html_url":"https://github.com/makersacademy/till_tech_test/pull/35","diff_url":"https://github.com/makersacademy/till_tech_test/pull/35.diff","patch_url":"https://github.com/makersacademy/till_tech_test/pull/35.patch","issue_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/35","number":35,"state":"open","locked":false,"title":"Lewis Pull Request","user":{"login":"ljones140","id":7063028,"avatar_url":"https://avatars.githubusercontent.com/u/7063028?v=3","gravatar_id":"","url":"https://api.github.com/users/ljones140","html_url":"https://github.com/ljones140","followers_url":"https://api.github.com/users/ljones140/followers","following_url":"https://api.github.com/users/ljones140/following{/other_user}","gists_url":"https://api.github.com/users/ljones140/gists{/gist_id}","starred_url":"https://api.github.com/users/ljones140/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljones140/subscriptions","organizations_url":"https://api.github.com/users/ljones140/orgs","repos_url":"https://api.github.com/users/ljones140/repos","events_url":"https://api.github.com/users/ljones140/events{/privacy}","received_events_url":"https://api.github.com/users/ljones140/received_events","type":"User","site_admin":false},"body":"Version 2 has been implemented with discounts.\r\n\r\nI was aware during this tech test that the domain being built was cash till for a coffee shop. Not an online store.","created_at":"2015-12-01T15:54:09Z","updated_at":"2015-12-01T15:54:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f8ffe349b9f275a7602870076276736a1c856a23","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/35/commits","review_comments_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/35/comments","review_comment_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/35/comments","statuses_url":"https://api.github.com/repos/makersacademy/till_tech_test/statuses/c804493dfd5afaaa2b9a19eb65c149a6ad908154","head":{"label":"ljones140:master","ref":"master","sha":"c804493dfd5afaaa2b9a19eb65c149a6ad908154","user":{"login":"ljones140","id":7063028,"avatar_url":"https://avatars.githubusercontent.com/u/7063028?v=3","gravatar_id":"","url":"https://api.github.com/users/ljones140","html_url":"https://github.com/ljones140","followers_url":"https://api.github.com/users/ljones140/followers","following_url":"https://api.github.com/users/ljones140/following{/other_user}","gists_url":"https://api.github.com/users/ljones140/gists{/gist_id}","starred_url":"https://api.github.com/users/ljones140/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljones140/subscriptions","organizations_url":"https://api.github.com/users/ljones140/orgs","repos_url":"https://api.github.com/users/ljones140/repos","events_url":"https://api.github.com/users/ljones140/events{/privacy}","received_events_url":"https://api.github.com/users/ljones140/received_events","type":"User","site_admin":false},"repo":{"id":46974051,"name":"till_tech_test","full_name":"ljones140/till_tech_test","owner":{"login":"ljones140","id":7063028,"avatar_url":"https://avatars.githubusercontent.com/u/7063028?v=3","gravatar_id":"","url":"https://api.github.com/users/ljones140","html_url":"https://github.com/ljones140","followers_url":"https://api.github.com/users/ljones140/followers","following_url":"https://api.github.com/users/ljones140/following{/other_user}","gists_url":"https://api.github.com/users/ljones140/gists{/gist_id}","starred_url":"https://api.github.com/users/ljones140/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljones140/subscriptions","organizations_url":"https://api.github.com/users/ljones140/orgs","repos_url":"https://api.github.com/users/ljones140/repos","events_url":"https://api.github.com/users/ljones140/events{/privacy}","received_events_url":"https://api.github.com/users/ljones140/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ljones140/till_tech_test","description":"Hiring week tech test","fork":true,"url":"https://api.github.com/repos/ljones140/till_tech_test","forks_url":"https://api.github.com/repos/ljones140/till_tech_test/forks","keys_url":"https://api.github.com/repos/ljones140/till_tech_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ljones140/till_tech_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ljones140/till_tech_test/teams","hooks_url":"https://api.github.com/repos/ljones140/till_tech_test/hooks","issue_events_url":"https://api.github.com/repos/ljones140/till_tech_test/issues/events{/number}","events_url":"https://api.github.com/repos/ljones140/till_tech_test/events","assignees_url":"https://api.github.com/repos/ljones140/till_tech_test/assignees{/user}","branches_url":"https://api.github.com/repos/ljones140/till_tech_test/branches{/branch}","tags_url":"https://api.github.com/repos/ljones140/till_tech_test/tags","blobs_url":"https://api.github.com/repos/ljones140/till_tech_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ljones140/till_tech_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ljones140/till_tech_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/ljones140/till_tech_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ljones140/till_tech_test/statuses/{sha}","languages_url":"https://api.github.com/repos/ljones140/till_tech_test/languages","stargazers_url":"https://api.github.com/repos/ljones140/till_tech_test/stargazers","contributors_url":"https://api.github.com/repos/ljones140/till_tech_test/contributors","subscribers_url":"https://api.github.com/repos/ljones140/till_tech_test/subscribers","subscription_url":"https://api.github.com/repos/ljones140/till_tech_test/subscription","commits_url":"https://api.github.com/repos/ljones140/till_tech_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/ljones140/till_tech_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/ljones140/till_tech_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/ljones140/till_tech_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/ljones140/till_tech_test/contents/{+path}","compare_url":"https://api.github.com/repos/ljones140/till_tech_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ljones140/till_tech_test/merges","archive_url":"https://api.github.com/repos/ljones140/till_tech_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ljones140/till_tech_test/downloads","issues_url":"https://api.github.com/repos/ljones140/till_tech_test/issues{/number}","pulls_url":"https://api.github.com/repos/ljones140/till_tech_test/pulls{/number}","milestones_url":"https://api.github.com/repos/ljones140/till_tech_test/milestones{/number}","notifications_url":"https://api.github.com/repos/ljones140/till_tech_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ljones140/till_tech_test/labels{/name}","releases_url":"https://api.github.com/repos/ljones140/till_tech_test/releases{/id}","created_at":"2015-11-27T10:21:50Z","updated_at":"2015-11-27T10:21:51Z","pushed_at":"2015-12-01T15:52:51Z","git_url":"git://github.com/ljones140/till_tech_test.git","ssh_url":"git@github.com:ljones140/till_tech_test.git","clone_url":"https://github.com/ljones140/till_tech_test.git","svn_url":"https://github.com/ljones140/till_tech_test","homepage":null,"size":136,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"makersacademy:master","ref":"master","sha":"c0f24f5be17a75f978ae982077e968aa2324ab12","user":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars.githubusercontent.com/u/3636186?v=3","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"repo":{"id":31914698,"name":"till_tech_test","full_name":"makersacademy/till_tech_test","owner":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars.githubusercontent.com/u/3636186?v=3","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/makersacademy/till_tech_test","description":"Hiring week tech test","fork":false,"url":"https://api.github.com/repos/makersacademy/till_tech_test","forks_url":"https://api.github.com/repos/makersacademy/till_tech_test/forks","keys_url":"https://api.github.com/repos/makersacademy/till_tech_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/makersacademy/till_tech_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/makersacademy/till_tech_test/teams","hooks_url":"https://api.github.com/repos/makersacademy/till_tech_test/hooks","issue_events_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/events{/number}","events_url":"https://api.github.com/repos/makersacademy/till_tech_test/events","assignees_url":"https://api.github.com/repos/makersacademy/till_tech_test/assignees{/user}","branches_url":"https://api.github.com/repos/makersacademy/till_tech_test/branches{/branch}","tags_url":"https://api.github.com/repos/makersacademy/till_tech_test/tags","blobs_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/makersacademy/till_tech_test/statuses/{sha}","languages_url":"https://api.github.com/repos/makersacademy/till_tech_test/languages","stargazers_url":"https://api.github.com/repos/makersacademy/till_tech_test/stargazers","contributors_url":"https://api.github.com/repos/makersacademy/till_tech_test/contributors","subscribers_url":"https://api.github.com/repos/makersacademy/till_tech_test/subscribers","subscription_url":"https://api.github.com/repos/makersacademy/till_tech_test/subscription","commits_url":"https://api.github.com/repos/makersacademy/till_tech_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/makersacademy/till_tech_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/makersacademy/till_tech_test/contents/{+path}","compare_url":"https://api.github.com/repos/makersacademy/till_tech_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/makersacademy/till_tech_test/merges","archive_url":"https://api.github.com/repos/makersacademy/till_tech_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/makersacademy/till_tech_test/downloads","issues_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues{/number}","pulls_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls{/number}","milestones_url":"https://api.github.com/repos/makersacademy/till_tech_test/milestones{/number}","notifications_url":"https://api.github.com/repos/makersacademy/till_tech_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/makersacademy/till_tech_test/labels{/name}","releases_url":"https://api.github.com/repos/makersacademy/till_tech_test/releases{/id}","created_at":"2015-03-09T18:16:02Z","updated_at":"2015-06-11T11:34:30Z","pushed_at":"2015-12-01T15:54:09Z","git_url":"git://github.com/makersacademy/till_tech_test.git","ssh_url":"git@github.com:makersacademy/till_tech_test.git","clone_url":"https://github.com/makersacademy/till_tech_test.git","svn_url":"https://github.com/makersacademy/till_tech_test","homepage":null,"size":52499,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":80,"mirror_url":null,"open_issues_count":29,"forks":80,"open_issues":29,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/35"},"html":{"href":"https://github.com/makersacademy/till_tech_test/pull/35"},"issue":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/issues/35"},"comments":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/statuses/c804493dfd5afaaa2b9a19eb65c149a6ad908154"}}}}