{"action":"created","comment":{"url":"https://api.github.com/repos/neslom/dinner_dash/pulls/comments/26277173","id":26277173,"diff_hunk":"@@ -0,0 +1,65 @@\n+require 'rails_helper'\n+\n+RSpec.describe Cart do\n+  let(:item_1) { create(:item, id: 1) }\n+  let(:item_2) { create(:item, id: 2) }\n+\n+  it \"has a hash of content by default\" do\n+    cart = Cart.new(nil)\n+    expect(cart.content.class).to eq(Hash)\n+  end\n+\n+  describe \"#add_item\" do\n+\n+    it \"can have items added\" do\n+      cart = Cart.new(nil)\n+\n+      cart.add_item(item_1.id)\n+      cart.add_item(item_1.id)\n+      cart.add_item(item_1.id)\n+      cart.add_item(item_2.id)\n+      cart.add_item(item_2.id)\n+\n+      expect(cart.content).to eq({1 => 3, 2 => 2})\n+    end\n+\n+  end\n+\n+  describe \"#remove_item\" do\n+\n+    it \"can have items removed\" do\n+      cart = Cart.new(nil)\n+\n+      5.times { cart.add_item(item_1.id) }\n+\n+      expect(cart.total_quantity).to eq(5)\n+\n+      cart.remove_item(item_1.id)\n+\n+      expect(cart.total_quantity).to eq(4)\n+    end\n+\n+    it \"deletes item pair from cart if the last one is removed\" do\n+      cart = Cart.new({1 => 1})\n+\n+      cart.remove_item(item_1.id)\n+\n+      expect(cart.content).to be_empty\n+","path":"spec/models/cart_spec.rb","position":48,"original_position":48,"commit_id":"4d81e70e2fe07f022891106bad8c68cd27285be8","original_commit_id":"4d81e70e2fe07f022891106bad8c68cd27285be8","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":"Extra empty line detected at block body end.","created_at":"2015-03-12T03:58:24Z","updated_at":"2015-03-12T03:58:24Z","html_url":"https://github.com/neslom/dinner_dash/pull/39#discussion_r26277173","pull_request_url":"https://api.github.com/repos/neslom/dinner_dash/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/neslom/dinner_dash/pulls/comments/26277173"},"html":{"href":"https://github.com/neslom/dinner_dash/pull/39#discussion_r26277173"},"pull_request":{"href":"https://api.github.com/repos/neslom/dinner_dash/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/neslom/dinner_dash/pulls/39","id":31006685,"html_url":"https://github.com/neslom/dinner_dash/pull/39","diff_url":"https://github.com/neslom/dinner_dash/pull/39.diff","patch_url":"https://github.com/neslom/dinner_dash/pull/39.patch","issue_url":"https://api.github.com/repos/neslom/dinner_dash/issues/39","number":39,"state":"open","locked":false,"title":"Can remove item from Cart","user":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-12T03:58:12Z","updated_at":"2015-03-12T03:58:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a6d2e88aaa7b4abd4ad0d7953d7c4faf69587dd7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neslom/dinner_dash/pulls/39/commits","review_comments_url":"https://api.github.com/repos/neslom/dinner_dash/pulls/39/comments","review_comment_url":"https://api.github.com/repos/neslom/dinner_dash/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neslom/dinner_dash/issues/39/comments","statuses_url":"https://api.github.com/repos/neslom/dinner_dash/statuses/4d81e70e2fe07f022891106bad8c68cd27285be8","head":{"label":"neslom:003_add_cart_items","ref":"003_add_cart_items","sha":"4d81e70e2fe07f022891106bad8c68cd27285be8","user":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"repo":{"id":31906336,"name":"dinner_dash","full_name":"neslom/dinner_dash","owner":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neslom/dinner_dash","description":"","fork":false,"url":"https://api.github.com/repos/neslom/dinner_dash","forks_url":"https://api.github.com/repos/neslom/dinner_dash/forks","keys_url":"https://api.github.com/repos/neslom/dinner_dash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neslom/dinner_dash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neslom/dinner_dash/teams","hooks_url":"https://api.github.com/repos/neslom/dinner_dash/hooks","issue_events_url":"https://api.github.com/repos/neslom/dinner_dash/issues/events{/number}","events_url":"https://api.github.com/repos/neslom/dinner_dash/events","assignees_url":"https://api.github.com/repos/neslom/dinner_dash/assignees{/user}","branches_url":"https://api.github.com/repos/neslom/dinner_dash/branches{/branch}","tags_url":"https://api.github.com/repos/neslom/dinner_dash/tags","blobs_url":"https://api.github.com/repos/neslom/dinner_dash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neslom/dinner_dash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neslom/dinner_dash/git/refs{/sha}","trees_url":"https://api.github.com/repos/neslom/dinner_dash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neslom/dinner_dash/statuses/{sha}","languages_url":"https://api.github.com/repos/neslom/dinner_dash/languages","stargazers_url":"https://api.github.com/repos/neslom/dinner_dash/stargazers","contributors_url":"https://api.github.com/repos/neslom/dinner_dash/contributors","subscribers_url":"https://api.github.com/repos/neslom/dinner_dash/subscribers","subscription_url":"https://api.github.com/repos/neslom/dinner_dash/subscription","commits_url":"https://api.github.com/repos/neslom/dinner_dash/commits{/sha}","git_commits_url":"https://api.github.com/repos/neslom/dinner_dash/git/commits{/sha}","comments_url":"https://api.github.com/repos/neslom/dinner_dash/comments{/number}","issue_comment_url":"https://api.github.com/repos/neslom/dinner_dash/issues/comments{/number}","contents_url":"https://api.github.com/repos/neslom/dinner_dash/contents/{+path}","compare_url":"https://api.github.com/repos/neslom/dinner_dash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neslom/dinner_dash/merges","archive_url":"https://api.github.com/repos/neslom/dinner_dash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neslom/dinner_dash/downloads","issues_url":"https://api.github.com/repos/neslom/dinner_dash/issues{/number}","pulls_url":"https://api.github.com/repos/neslom/dinner_dash/pulls{/number}","milestones_url":"https://api.github.com/repos/neslom/dinner_dash/milestones{/number}","notifications_url":"https://api.github.com/repos/neslom/dinner_dash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neslom/dinner_dash/labels{/name}","releases_url":"https://api.github.com/repos/neslom/dinner_dash/releases{/id}","created_at":"2015-03-09T15:28:39Z","updated_at":"2015-03-12T03:56:19Z","pushed_at":"2015-03-12T03:56:21Z","git_url":"git://github.com/neslom/dinner_dash.git","ssh_url":"git@github.com:neslom/dinner_dash.git","clone_url":"https://github.com/neslom/dinner_dash.git","svn_url":"https://github.com/neslom/dinner_dash","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":22,"forks":1,"open_issues":22,"watchers":0,"default_branch":"master"}},"base":{"label":"neslom:master","ref":"master","sha":"d5085711c5cdaaa53e4e554b3341c3ea7d46790e","user":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"repo":{"id":31906336,"name":"dinner_dash","full_name":"neslom/dinner_dash","owner":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neslom/dinner_dash","description":"","fork":false,"url":"https://api.github.com/repos/neslom/dinner_dash","forks_url":"https://api.github.com/repos/neslom/dinner_dash/forks","keys_url":"https://api.github.com/repos/neslom/dinner_dash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neslom/dinner_dash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neslom/dinner_dash/teams","hooks_url":"https://api.github.com/repos/neslom/dinner_dash/hooks","issue_events_url":"https://api.github.com/repos/neslom/dinner_dash/issues/events{/number}","events_url":"https://api.github.com/repos/neslom/dinner_dash/events","assignees_url":"https://api.github.com/repos/neslom/dinner_dash/assignees{/user}","branches_url":"https://api.github.com/repos/neslom/dinner_dash/branches{/branch}","tags_url":"https://api.github.com/repos/neslom/dinner_dash/tags","blobs_url":"https://api.github.com/repos/neslom/dinner_dash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neslom/dinner_dash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neslom/dinner_dash/git/refs{/sha}","trees_url":"https://api.github.com/repos/neslom/dinner_dash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neslom/dinner_dash/statuses/{sha}","languages_url":"https://api.github.com/repos/neslom/dinner_dash/languages","stargazers_url":"https://api.github.com/repos/neslom/dinner_dash/stargazers","contributors_url":"https://api.github.com/repos/neslom/dinner_dash/contributors","subscribers_url":"https://api.github.com/repos/neslom/dinner_dash/subscribers","subscription_url":"https://api.github.com/repos/neslom/dinner_dash/subscription","commits_url":"https://api.github.com/repos/neslom/dinner_dash/commits{/sha}","git_commits_url":"https://api.github.com/repos/neslom/dinner_dash/git/commits{/sha}","comments_url":"https://api.github.com/repos/neslom/dinner_dash/comments{/number}","issue_comment_url":"https://api.github.com/repos/neslom/dinner_dash/issues/comments{/number}","contents_url":"https://api.github.com/repos/neslom/dinner_dash/contents/{+path}","compare_url":"https://api.github.com/repos/neslom/dinner_dash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neslom/dinner_dash/merges","archive_url":"https://api.github.com/repos/neslom/dinner_dash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neslom/dinner_dash/downloads","issues_url":"https://api.github.com/repos/neslom/dinner_dash/issues{/number}","pulls_url":"https://api.github.com/repos/neslom/dinner_dash/pulls{/number}","milestones_url":"https://api.github.com/repos/neslom/dinner_dash/milestones{/number}","notifications_url":"https://api.github.com/repos/neslom/dinner_dash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neslom/dinner_dash/labels{/name}","releases_url":"https://api.github.com/repos/neslom/dinner_dash/releases{/id}","created_at":"2015-03-09T15:28:39Z","updated_at":"2015-03-12T03:56:19Z","pushed_at":"2015-03-12T03:56:21Z","git_url":"git://github.com/neslom/dinner_dash.git","ssh_url":"git@github.com:neslom/dinner_dash.git","clone_url":"https://github.com/neslom/dinner_dash.git","svn_url":"https://github.com/neslom/dinner_dash","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":22,"forks":1,"open_issues":22,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neslom/dinner_dash/pulls/39"},"html":{"href":"https://github.com/neslom/dinner_dash/pull/39"},"issue":{"href":"https://api.github.com/repos/neslom/dinner_dash/issues/39"},"comments":{"href":"https://api.github.com/repos/neslom/dinner_dash/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/neslom/dinner_dash/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/neslom/dinner_dash/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neslom/dinner_dash/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/neslom/dinner_dash/statuses/4d81e70e2fe07f022891106bad8c68cd27285be8"}}}}