{"action":"created","comment":{"url":"https://api.github.com/repos/rasensio1/rails_engine/pulls/comments/43972202","id":43972202,"diff_hunk":"@@ -16,25 +16,63 @@ class Api::V1::Merchants::BusinessControllerTest < ActionController::TestCase\n     merch2 = create_merchant_2\n     merch3 = create_merchant_3\n \n-    get :most_revenue, top: 2\n+    get :most_revenue, quantity: 2\n \n     assert_response :success\n     assert_equal 800, json.first[\"revenue\"]\n     assert_equal 300, json.second[\"revenue\"]\n   end\n \n+  test \"#most_items\" do\n+    merch = create_merchant_1\n+    merch2 = create_merchant_2\n+    merch3 = create_merchant_3\n+\n+    get :most_items , quantity: 2\n+\n+    assert_response :success\n+    assert_equal \"First\", json.first[\"name\"]\n+    assert_equal \"Another\", json.second[\"name\"]\n+  end\n+\n+  test \"#favorite_customer\" do\n+    merch = create_merchant_2\n+\n+    get :favorite_customer, id: merch.id\n+\n+    assert_response :success\n+    assert_equal \"John\", json[\"first_name\"]\n+  end\n+\n+  test \"#pending_invoices\" do\n+    merch = create_merchant_1\n+    get :pending_invoices, id: merch.id\n+\n+    assert_response :success\n+    assert_equal \"Hi\", json.first[\"first_name\"]\n+  end\n+\n+  test \"#total revenue for date\" do\n+    merch = create_merchant_1\n+\n+    get :revenue_date, date: \"2012-03-16 11:55:05\"\n+\n+    assert_response :success\n+    assert_equal \"8.0\", json[\"total_revenue\"]\n+  end\n+\n    def create_merchant_1\n      m = Merchant.create(name: \"First\")\n      c1 = Customer.create(first_name: \"Hi\", last_name: \"YOYO\")\n      c2 = Customer.create(first_name: \"yo\", last_name: \"yo\")\n-     i1 = Invoice.create(customer_id: c1.id, merchant_id: m.id)\n+     i1 = Invoice.create(customer_id: c1.id, merchant_id: m.id, created_at: \"2012-03-16 11:55:05\")\n      item = Item.create(name: \"item\", description: \"ok\", unit_price: 100, merchant_id: m.id)\n      InvoiceItem.create(quantity: 2, unit_price: 100, item_id: item.id, invoice_id: i1.id)\n      InvoiceItem.create(quantity: 1, unit_price: 300, item_id: item.id, invoice_id: i1.id)\n-     i3 = Invoice.create(customer_id: c1.id, merchant_id: m.id)\n+     i3 = Invoice.create(customer_id: c1.id, merchant_id: m.id, created_at: \"2012-03-16 11:55:05\")","path":"test/controllers/api/v1/merchants/business_controller_test.rb","position":60,"original_position":60,"commit_id":"d21b208f18431b926d3938107b12c79e96d48776","original_commit_id":"d21b208f18431b926d3938107b12c79e96d48776","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":"Line is too long. [98/80]","created_at":"2015-11-05T03:10:14Z","updated_at":"2015-11-05T03:10:14Z","html_url":"https://github.com/rasensio1/rails_engine/pull/13#discussion_r43972202","pull_request_url":"https://api.github.com/repos/rasensio1/rails_engine/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/rasensio1/rails_engine/pulls/comments/43972202"},"html":{"href":"https://github.com/rasensio1/rails_engine/pull/13#discussion_r43972202"},"pull_request":{"href":"https://api.github.com/repos/rasensio1/rails_engine/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/rasensio1/rails_engine/pulls/13","id":49777492,"html_url":"https://github.com/rasensio1/rails_engine/pull/13","diff_url":"https://github.com/rasensio1/rails_engine/pull/13.diff","patch_url":"https://github.com/rasensio1/rails_engine/pull/13.patch","issue_url":"https://api.github.com/repos/rasensio1/rails_engine/issues/13","number":13,"state":"open","locked":false,"title":"More bi","user":{"login":"rasensio1","id":12215523,"avatar_url":"https://avatars.githubusercontent.com/u/12215523?v=3","gravatar_id":"","url":"https://api.github.com/users/rasensio1","html_url":"https://github.com/rasensio1","followers_url":"https://api.github.com/users/rasensio1/followers","following_url":"https://api.github.com/users/rasensio1/following{/other_user}","gists_url":"https://api.github.com/users/rasensio1/gists{/gist_id}","starred_url":"https://api.github.com/users/rasensio1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rasensio1/subscriptions","organizations_url":"https://api.github.com/users/rasensio1/orgs","repos_url":"https://api.github.com/users/rasensio1/repos","events_url":"https://api.github.com/users/rasensio1/events{/privacy}","received_events_url":"https://api.github.com/users/rasensio1/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-05T03:10:06Z","updated_at":"2015-11-05T03:10:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7488527a141ce40a44fa0bd487a671c64fa935c2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rasensio1/rails_engine/pulls/13/commits","review_comments_url":"https://api.github.com/repos/rasensio1/rails_engine/pulls/13/comments","review_comment_url":"https://api.github.com/repos/rasensio1/rails_engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rasensio1/rails_engine/issues/13/comments","statuses_url":"https://api.github.com/repos/rasensio1/rails_engine/statuses/d21b208f18431b926d3938107b12c79e96d48776","head":{"label":"rasensio1:more-bi","ref":"more-bi","sha":"d21b208f18431b926d3938107b12c79e96d48776","user":{"login":"rasensio1","id":12215523,"avatar_url":"https://avatars.githubusercontent.com/u/12215523?v=3","gravatar_id":"","url":"https://api.github.com/users/rasensio1","html_url":"https://github.com/rasensio1","followers_url":"https://api.github.com/users/rasensio1/followers","following_url":"https://api.github.com/users/rasensio1/following{/other_user}","gists_url":"https://api.github.com/users/rasensio1/gists{/gist_id}","starred_url":"https://api.github.com/users/rasensio1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rasensio1/subscriptions","organizations_url":"https://api.github.com/users/rasensio1/orgs","repos_url":"https://api.github.com/users/rasensio1/repos","events_url":"https://api.github.com/users/rasensio1/events{/privacy}","received_events_url":"https://api.github.com/users/rasensio1/received_events","type":"User","site_admin":false},"repo":{"id":45427347,"name":"rails_engine","full_name":"rasensio1/rails_engine","owner":{"login":"rasensio1","id":12215523,"avatar_url":"https://avatars.githubusercontent.com/u/12215523?v=3","gravatar_id":"","url":"https://api.github.com/users/rasensio1","html_url":"https://github.com/rasensio1","followers_url":"https://api.github.com/users/rasensio1/followers","following_url":"https://api.github.com/users/rasensio1/following{/other_user}","gists_url":"https://api.github.com/users/rasensio1/gists{/gist_id}","starred_url":"https://api.github.com/users/rasensio1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rasensio1/subscriptions","organizations_url":"https://api.github.com/users/rasensio1/orgs","repos_url":"https://api.github.com/users/rasensio1/repos","events_url":"https://api.github.com/users/rasensio1/events{/privacy}","received_events_url":"https://api.github.com/users/rasensio1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rasensio1/rails_engine","description":"","fork":false,"url":"https://api.github.com/repos/rasensio1/rails_engine","forks_url":"https://api.github.com/repos/rasensio1/rails_engine/forks","keys_url":"https://api.github.com/repos/rasensio1/rails_engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rasensio1/rails_engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rasensio1/rails_engine/teams","hooks_url":"https://api.github.com/repos/rasensio1/rails_engine/hooks","issue_events_url":"https://api.github.com/repos/rasensio1/rails_engine/issues/events{/number}","events_url":"https://api.github.com/repos/rasensio1/rails_engine/events","assignees_url":"https://api.github.com/repos/rasensio1/rails_engine/assignees{/user}","branches_url":"https://api.github.com/repos/rasensio1/rails_engine/branches{/branch}","tags_url":"https://api.github.com/repos/rasensio1/rails_engine/tags","blobs_url":"https://api.github.com/repos/rasensio1/rails_engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rasensio1/rails_engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rasensio1/rails_engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/rasensio1/rails_engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rasensio1/rails_engine/statuses/{sha}","languages_url":"https://api.github.com/repos/rasensio1/rails_engine/languages","stargazers_url":"https://api.github.com/repos/rasensio1/rails_engine/stargazers","contributors_url":"https://api.github.com/repos/rasensio1/rails_engine/contributors","subscribers_url":"https://api.github.com/repos/rasensio1/rails_engine/subscribers","subscription_url":"https://api.github.com/repos/rasensio1/rails_engine/subscription","commits_url":"https://api.github.com/repos/rasensio1/rails_engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/rasensio1/rails_engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/rasensio1/rails_engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/rasensio1/rails_engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/rasensio1/rails_engine/contents/{+path}","compare_url":"https://api.github.com/repos/rasensio1/rails_engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rasensio1/rails_engine/merges","archive_url":"https://api.github.com/repos/rasensio1/rails_engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rasensio1/rails_engine/downloads","issues_url":"https://api.github.com/repos/rasensio1/rails_engine/issues{/number}","pulls_url":"https://api.github.com/repos/rasensio1/rails_engine/pulls{/number}","milestones_url":"https://api.github.com/repos/rasensio1/rails_engine/milestones{/number}","notifications_url":"https://api.github.com/repos/rasensio1/rails_engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rasensio1/rails_engine/labels{/name}","releases_url":"https://api.github.com/repos/rasensio1/rails_engine/releases{/id}","created_at":"2015-11-02T22:51:53Z","updated_at":"2015-11-02T22:52:02Z","pushed_at":"2015-11-05T03:10:06Z","git_url":"git://github.com/rasensio1/rails_engine.git","ssh_url":"git@github.com:rasensio1/rails_engine.git","clone_url":"https://github.com/rasensio1/rails_engine.git","svn_url":"https://github.com/rasensio1/rails_engine","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":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"rasensio1:master","ref":"master","sha":"9100f22c664e2ca69e5b525cc4fb7aadcc699b10","user":{"login":"rasensio1","id":12215523,"avatar_url":"https://avatars.githubusercontent.com/u/12215523?v=3","gravatar_id":"","url":"https://api.github.com/users/rasensio1","html_url":"https://github.com/rasensio1","followers_url":"https://api.github.com/users/rasensio1/followers","following_url":"https://api.github.com/users/rasensio1/following{/other_user}","gists_url":"https://api.github.com/users/rasensio1/gists{/gist_id}","starred_url":"https://api.github.com/users/rasensio1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rasensio1/subscriptions","organizations_url":"https://api.github.com/users/rasensio1/orgs","repos_url":"https://api.github.com/users/rasensio1/repos","events_url":"https://api.github.com/users/rasensio1/events{/privacy}","received_events_url":"https://api.github.com/users/rasensio1/received_events","type":"User","site_admin":false},"repo":{"id":45427347,"name":"rails_engine","full_name":"rasensio1/rails_engine","owner":{"login":"rasensio1","id":12215523,"avatar_url":"https://avatars.githubusercontent.com/u/12215523?v=3","gravatar_id":"","url":"https://api.github.com/users/rasensio1","html_url":"https://github.com/rasensio1","followers_url":"https://api.github.com/users/rasensio1/followers","following_url":"https://api.github.com/users/rasensio1/following{/other_user}","gists_url":"https://api.github.com/users/rasensio1/gists{/gist_id}","starred_url":"https://api.github.com/users/rasensio1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rasensio1/subscriptions","organizations_url":"https://api.github.com/users/rasensio1/orgs","repos_url":"https://api.github.com/users/rasensio1/repos","events_url":"https://api.github.com/users/rasensio1/events{/privacy}","received_events_url":"https://api.github.com/users/rasensio1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rasensio1/rails_engine","description":"","fork":false,"url":"https://api.github.com/repos/rasensio1/rails_engine","forks_url":"https://api.github.com/repos/rasensio1/rails_engine/forks","keys_url":"https://api.github.com/repos/rasensio1/rails_engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rasensio1/rails_engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rasensio1/rails_engine/teams","hooks_url":"https://api.github.com/repos/rasensio1/rails_engine/hooks","issue_events_url":"https://api.github.com/repos/rasensio1/rails_engine/issues/events{/number}","events_url":"https://api.github.com/repos/rasensio1/rails_engine/events","assignees_url":"https://api.github.com/repos/rasensio1/rails_engine/assignees{/user}","branches_url":"https://api.github.com/repos/rasensio1/rails_engine/branches{/branch}","tags_url":"https://api.github.com/repos/rasensio1/rails_engine/tags","blobs_url":"https://api.github.com/repos/rasensio1/rails_engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rasensio1/rails_engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rasensio1/rails_engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/rasensio1/rails_engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rasensio1/rails_engine/statuses/{sha}","languages_url":"https://api.github.com/repos/rasensio1/rails_engine/languages","stargazers_url":"https://api.github.com/repos/rasensio1/rails_engine/stargazers","contributors_url":"https://api.github.com/repos/rasensio1/rails_engine/contributors","subscribers_url":"https://api.github.com/repos/rasensio1/rails_engine/subscribers","subscription_url":"https://api.github.com/repos/rasensio1/rails_engine/subscription","commits_url":"https://api.github.com/repos/rasensio1/rails_engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/rasensio1/rails_engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/rasensio1/rails_engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/rasensio1/rails_engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/rasensio1/rails_engine/contents/{+path}","compare_url":"https://api.github.com/repos/rasensio1/rails_engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rasensio1/rails_engine/merges","archive_url":"https://api.github.com/repos/rasensio1/rails_engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rasensio1/rails_engine/downloads","issues_url":"https://api.github.com/repos/rasensio1/rails_engine/issues{/number}","pulls_url":"https://api.github.com/repos/rasensio1/rails_engine/pulls{/number}","milestones_url":"https://api.github.com/repos/rasensio1/rails_engine/milestones{/number}","notifications_url":"https://api.github.com/repos/rasensio1/rails_engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rasensio1/rails_engine/labels{/name}","releases_url":"https://api.github.com/repos/rasensio1/rails_engine/releases{/id}","created_at":"2015-11-02T22:51:53Z","updated_at":"2015-11-02T22:52:02Z","pushed_at":"2015-11-05T03:10:06Z","git_url":"git://github.com/rasensio1/rails_engine.git","ssh_url":"git@github.com:rasensio1/rails_engine.git","clone_url":"https://github.com/rasensio1/rails_engine.git","svn_url":"https://github.com/rasensio1/rails_engine","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":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rasensio1/rails_engine/pulls/13"},"html":{"href":"https://github.com/rasensio1/rails_engine/pull/13"},"issue":{"href":"https://api.github.com/repos/rasensio1/rails_engine/issues/13"},"comments":{"href":"https://api.github.com/repos/rasensio1/rails_engine/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/rasensio1/rails_engine/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/rasensio1/rails_engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rasensio1/rails_engine/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/rasensio1/rails_engine/statuses/d21b208f18431b926d3938107b12c79e96d48776"}}}}