{"action":"created","comment":{"url":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/comments/33082672","id":33082672,"diff_hunk":"@@ -41,10 +41,45 @@ def test_find_merchant_returns_a_merchant_associated_with_item\n     assert_equal 'Schroeder-Jerde', result_1.name\n   end\n \n+  def test_best_day_returns_date_with_the_most_sales_for_given_item_using_the_invoice_date\n+    load_data\n+    result_1 = @se.item_repository.items[0].best_day\n+\n+    assert_equal Date.parse(\"Jun 30, 2015\"), result_1\n+  end\n   private\n \n   def fixtures_directory\n-    File.expand_path('../../data/fixtures', __FILE__)\n+    File.expand_path('../../data/fixtures',__FILE__)\n+  end\n+\n+  def load_data\n+    repo_data = {\n+        items: [\n+            { id: 1, unit_price: 5_000, created_at: \"Jan, 15, 2015\", updated_at: \"Jan, 15, 2015\" },\n+        ],\n+\n+        invoices: [\n+            { id: 10, created_at: \"June 1, 2015\" },\n+            { id: 20, created_at: \"June 15, 2015\" },\n+            { id: 30, created_at: \"June 30, 2015\" }\n+        ],\n+\n+        invoice_items: [\n+            { id: 100, item_id: 1, invoice_id: 10, quantity: 1_000, unit_price: 5_000 },\n+            { id: 200, item_id: 1, invoice_id: 20, quantity: 2_000, unit_price: 55_000 },\n+            { id: 300, item_id: 1, invoice_id: 30, quantity: 3_000, unit_price: 555_000 }\n+        ],\n+\n+        transactions: [\n+            { id: 7, invoice_id: 10, result: \"success\"},\n+            { id: 8, invoice_id: 20, result: \"success\"},","path":"test/item_test.rb","position":37,"original_position":37,"commit_id":"80734223139d95ef1956bfe7978b1da48e7007d5","original_commit_id":"80734223139d95ef1956bfe7978b1da48e7007d5","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":"Space inside } missing.","created_at":"2015-06-23T19:41:56Z","updated_at":"2015-06-23T19:41:56Z","html_url":"https://github.com/marlabrizel/sales_engine/pull/55#discussion_r33082672","pull_request_url":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/comments/33082672"},"html":{"href":"https://github.com/marlabrizel/sales_engine/pull/55#discussion_r33082672"},"pull_request":{"href":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/55","id":38374746,"html_url":"https://github.com/marlabrizel/sales_engine/pull/55","diff_url":"https://github.com/marlabrizel/sales_engine/pull/55.diff","patch_url":"https://github.com/marlabrizel/sales_engine/pull/55.patch","issue_url":"https://api.github.com/repos/marlabrizel/sales_engine/issues/55","number":55,"state":"open","locked":false,"title":"Item best day","user":{"login":"sabondano","id":1958868,"avatar_url":"https://avatars.githubusercontent.com/u/1958868?v=3","gravatar_id":"","url":"https://api.github.com/users/sabondano","html_url":"https://github.com/sabondano","followers_url":"https://api.github.com/users/sabondano/followers","following_url":"https://api.github.com/users/sabondano/following{/other_user}","gists_url":"https://api.github.com/users/sabondano/gists{/gist_id}","starred_url":"https://api.github.com/users/sabondano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sabondano/subscriptions","organizations_url":"https://api.github.com/users/sabondano/orgs","repos_url":"https://api.github.com/users/sabondano/repos","events_url":"https://api.github.com/users/sabondano/events{/privacy}","received_events_url":"https://api.github.com/users/sabondano/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-23T19:41:49Z","updated_at":"2015-06-23T19:41:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"227531787ef53d2858c405c952e27a530dca1cb5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/55/commits","review_comments_url":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/55/comments","review_comment_url":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/marlabrizel/sales_engine/issues/55/comments","statuses_url":"https://api.github.com/repos/marlabrizel/sales_engine/statuses/80734223139d95ef1956bfe7978b1da48e7007d5","head":{"label":"marlabrizel:item-best-day","ref":"item-best-day","sha":"80734223139d95ef1956bfe7978b1da48e7007d5","user":{"login":"marlabrizel","id":6632025,"avatar_url":"https://avatars.githubusercontent.com/u/6632025?v=3","gravatar_id":"","url":"https://api.github.com/users/marlabrizel","html_url":"https://github.com/marlabrizel","followers_url":"https://api.github.com/users/marlabrizel/followers","following_url":"https://api.github.com/users/marlabrizel/following{/other_user}","gists_url":"https://api.github.com/users/marlabrizel/gists{/gist_id}","starred_url":"https://api.github.com/users/marlabrizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marlabrizel/subscriptions","organizations_url":"https://api.github.com/users/marlabrizel/orgs","repos_url":"https://api.github.com/users/marlabrizel/repos","events_url":"https://api.github.com/users/marlabrizel/events{/privacy}","received_events_url":"https://api.github.com/users/marlabrizel/received_events","type":"User","site_admin":false},"repo":{"id":37489691,"name":"sales_engine","full_name":"marlabrizel/sales_engine","owner":{"login":"marlabrizel","id":6632025,"avatar_url":"https://avatars.githubusercontent.com/u/6632025?v=3","gravatar_id":"","url":"https://api.github.com/users/marlabrizel","html_url":"https://github.com/marlabrizel","followers_url":"https://api.github.com/users/marlabrizel/followers","following_url":"https://api.github.com/users/marlabrizel/following{/other_user}","gists_url":"https://api.github.com/users/marlabrizel/gists{/gist_id}","starred_url":"https://api.github.com/users/marlabrizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marlabrizel/subscriptions","organizations_url":"https://api.github.com/users/marlabrizel/orgs","repos_url":"https://api.github.com/users/marlabrizel/repos","events_url":"https://api.github.com/users/marlabrizel/events{/privacy}","received_events_url":"https://api.github.com/users/marlabrizel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marlabrizel/sales_engine","description":"","fork":false,"url":"https://api.github.com/repos/marlabrizel/sales_engine","forks_url":"https://api.github.com/repos/marlabrizel/sales_engine/forks","keys_url":"https://api.github.com/repos/marlabrizel/sales_engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marlabrizel/sales_engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marlabrizel/sales_engine/teams","hooks_url":"https://api.github.com/repos/marlabrizel/sales_engine/hooks","issue_events_url":"https://api.github.com/repos/marlabrizel/sales_engine/issues/events{/number}","events_url":"https://api.github.com/repos/marlabrizel/sales_engine/events","assignees_url":"https://api.github.com/repos/marlabrizel/sales_engine/assignees{/user}","branches_url":"https://api.github.com/repos/marlabrizel/sales_engine/branches{/branch}","tags_url":"https://api.github.com/repos/marlabrizel/sales_engine/tags","blobs_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marlabrizel/sales_engine/statuses/{sha}","languages_url":"https://api.github.com/repos/marlabrizel/sales_engine/languages","stargazers_url":"https://api.github.com/repos/marlabrizel/sales_engine/stargazers","contributors_url":"https://api.github.com/repos/marlabrizel/sales_engine/contributors","subscribers_url":"https://api.github.com/repos/marlabrizel/sales_engine/subscribers","subscription_url":"https://api.github.com/repos/marlabrizel/sales_engine/subscription","commits_url":"https://api.github.com/repos/marlabrizel/sales_engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/marlabrizel/sales_engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/marlabrizel/sales_engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/marlabrizel/sales_engine/contents/{+path}","compare_url":"https://api.github.com/repos/marlabrizel/sales_engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marlabrizel/sales_engine/merges","archive_url":"https://api.github.com/repos/marlabrizel/sales_engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marlabrizel/sales_engine/downloads","issues_url":"https://api.github.com/repos/marlabrizel/sales_engine/issues{/number}","pulls_url":"https://api.github.com/repos/marlabrizel/sales_engine/pulls{/number}","milestones_url":"https://api.github.com/repos/marlabrizel/sales_engine/milestones{/number}","notifications_url":"https://api.github.com/repos/marlabrizel/sales_engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marlabrizel/sales_engine/labels{/name}","releases_url":"https://api.github.com/repos/marlabrizel/sales_engine/releases{/id}","created_at":"2015-06-15T20:31:30Z","updated_at":"2015-06-23T00:40:05Z","pushed_at":"2015-06-23T19:41:50Z","git_url":"git://github.com/marlabrizel/sales_engine.git","ssh_url":"git@github.com:marlabrizel/sales_engine.git","clone_url":"https://github.com/marlabrizel/sales_engine.git","svn_url":"https://github.com/marlabrizel/sales_engine","homepage":null,"size":1487,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"marlabrizel:master","ref":"master","sha":"c8db054cd232c4f95c4f2375021d9abd86a03a25","user":{"login":"marlabrizel","id":6632025,"avatar_url":"https://avatars.githubusercontent.com/u/6632025?v=3","gravatar_id":"","url":"https://api.github.com/users/marlabrizel","html_url":"https://github.com/marlabrizel","followers_url":"https://api.github.com/users/marlabrizel/followers","following_url":"https://api.github.com/users/marlabrizel/following{/other_user}","gists_url":"https://api.github.com/users/marlabrizel/gists{/gist_id}","starred_url":"https://api.github.com/users/marlabrizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marlabrizel/subscriptions","organizations_url":"https://api.github.com/users/marlabrizel/orgs","repos_url":"https://api.github.com/users/marlabrizel/repos","events_url":"https://api.github.com/users/marlabrizel/events{/privacy}","received_events_url":"https://api.github.com/users/marlabrizel/received_events","type":"User","site_admin":false},"repo":{"id":37489691,"name":"sales_engine","full_name":"marlabrizel/sales_engine","owner":{"login":"marlabrizel","id":6632025,"avatar_url":"https://avatars.githubusercontent.com/u/6632025?v=3","gravatar_id":"","url":"https://api.github.com/users/marlabrizel","html_url":"https://github.com/marlabrizel","followers_url":"https://api.github.com/users/marlabrizel/followers","following_url":"https://api.github.com/users/marlabrizel/following{/other_user}","gists_url":"https://api.github.com/users/marlabrizel/gists{/gist_id}","starred_url":"https://api.github.com/users/marlabrizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marlabrizel/subscriptions","organizations_url":"https://api.github.com/users/marlabrizel/orgs","repos_url":"https://api.github.com/users/marlabrizel/repos","events_url":"https://api.github.com/users/marlabrizel/events{/privacy}","received_events_url":"https://api.github.com/users/marlabrizel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marlabrizel/sales_engine","description":"","fork":false,"url":"https://api.github.com/repos/marlabrizel/sales_engine","forks_url":"https://api.github.com/repos/marlabrizel/sales_engine/forks","keys_url":"https://api.github.com/repos/marlabrizel/sales_engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marlabrizel/sales_engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marlabrizel/sales_engine/teams","hooks_url":"https://api.github.com/repos/marlabrizel/sales_engine/hooks","issue_events_url":"https://api.github.com/repos/marlabrizel/sales_engine/issues/events{/number}","events_url":"https://api.github.com/repos/marlabrizel/sales_engine/events","assignees_url":"https://api.github.com/repos/marlabrizel/sales_engine/assignees{/user}","branches_url":"https://api.github.com/repos/marlabrizel/sales_engine/branches{/branch}","tags_url":"https://api.github.com/repos/marlabrizel/sales_engine/tags","blobs_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marlabrizel/sales_engine/statuses/{sha}","languages_url":"https://api.github.com/repos/marlabrizel/sales_engine/languages","stargazers_url":"https://api.github.com/repos/marlabrizel/sales_engine/stargazers","contributors_url":"https://api.github.com/repos/marlabrizel/sales_engine/contributors","subscribers_url":"https://api.github.com/repos/marlabrizel/sales_engine/subscribers","subscription_url":"https://api.github.com/repos/marlabrizel/sales_engine/subscription","commits_url":"https://api.github.com/repos/marlabrizel/sales_engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/marlabrizel/sales_engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/marlabrizel/sales_engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/marlabrizel/sales_engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/marlabrizel/sales_engine/contents/{+path}","compare_url":"https://api.github.com/repos/marlabrizel/sales_engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marlabrizel/sales_engine/merges","archive_url":"https://api.github.com/repos/marlabrizel/sales_engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marlabrizel/sales_engine/downloads","issues_url":"https://api.github.com/repos/marlabrizel/sales_engine/issues{/number}","pulls_url":"https://api.github.com/repos/marlabrizel/sales_engine/pulls{/number}","milestones_url":"https://api.github.com/repos/marlabrizel/sales_engine/milestones{/number}","notifications_url":"https://api.github.com/repos/marlabrizel/sales_engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marlabrizel/sales_engine/labels{/name}","releases_url":"https://api.github.com/repos/marlabrizel/sales_engine/releases{/id}","created_at":"2015-06-15T20:31:30Z","updated_at":"2015-06-23T00:40:05Z","pushed_at":"2015-06-23T19:41:50Z","git_url":"git://github.com/marlabrizel/sales_engine.git","ssh_url":"git@github.com:marlabrizel/sales_engine.git","clone_url":"https://github.com/marlabrizel/sales_engine.git","svn_url":"https://github.com/marlabrizel/sales_engine","homepage":null,"size":1487,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/55"},"html":{"href":"https://github.com/marlabrizel/sales_engine/pull/55"},"issue":{"href":"https://api.github.com/repos/marlabrizel/sales_engine/issues/55"},"comments":{"href":"https://api.github.com/repos/marlabrizel/sales_engine/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/marlabrizel/sales_engine/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/marlabrizel/sales_engine/statuses/80734223139d95ef1956bfe7978b1da48e7007d5"}}}}