{"action":"created","comment":{"url":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/comments/180593613","pull_request_review_id":111041749,"id":180593613,"diff_hunk":"@@ -0,0 +1,166 @@\n+require 'minitest'\n+require 'minitest/autorun'\n+require 'minitest/pride'\n+require './lib/item'\n+require 'bigdecimal'\n+require 'simplecov'\n+SimpleCov.start\n+require './lib/item_repository'\n+\n+class ItemRepositoryTest < Minitest::Test\n+\n+  def setup\n+    @icons = [\n+      \"id: 263395237\",\n+      \"name: RealPush Icon Set\",\n+      \"description: It writes things.\",\n+      \"unit_price: 1200\",\n+      \"merchant_id: 12334141\",\n+      \"created_at: 2016-01-11 09:34:06 UTC\",\n+      \"updated_at: 2007-06-04 21:35:10 UTC\"\n+    ]\n+    @glitter_frames = [\n+      \"id: 263395617\",\n+      \"name: Glitter Scrabble Frames\",\n+      \"description: Any colour glitter.\",\n+      \"unit_price: 1300\",\n+      \"merchant_id: 12334185\",\n+      \"created_at: 2016-01-11 11:51:37 UTC\",\n+      \"updated_at: 1993-09-29 11:56:40 UTC\"\n+    ]\n+    @wooden_letters = [\n+      \"id: 263396013\",\n+      \"name: Free Standing Wooden Letters\",\n+      \"description: Free standing wooden letters, 15cm, any colour.\",\n+      \"unit_price: 700\",\n+      \"merchant_id: 12334105\",\n+      \"created_at: 2016-01-11 11:51:36 UTC\",\n+      \"updated_at: 2001-09-17 15:28:43 UTC\"\n+    ]\n+      @items = [@icons, @glitter_frames, @wooden_letters]\n+    end\n+\n+  def test_it_exists\n+    ir = ItemRepository.new(@items)\n+\n+    assert_instance_of ItemRepository, ir\n+  end\n+\n+  def test_repo_holds_items\n+    ir = ItemRepository.new(@items)\n+\n+    ir.items.all? do |item|\n+      assert_instance_of Item, item\n+    end\n+  end\n+\n+  def test_can_find_all\n+    ir = ItemRepository.new(@items)\n+\n+    ir.all.all? do |item|\n+      assert_instance_of Item, item\n+    end\n+  end\n+\n+  def test_can_find_by_id\n+    ir = ItemRepository.new(@items)\n+\n+    assert_equal 263395237, ir.find_by_id(263395237).id\n+    assert_equal \"RealPush Icon Set\", ir.find_by_id(263395237).name\n+    assert_equal \"It writes things.\", ir.find_by_id(263395237).description\n+    assert_equal 263395617, ir.find_by_id(263395617).id\n+    assert_instance_of Time, ir.find_by_id(263395617).created_at\n+    assert_equal 12334105, ir.find_by_id(263396013).merchant_id\n+    assert_nil ir.find_by_id(444444444)\n+  end\n+\n+  def test_can_find_by_name\n+    ir = ItemRepository.new(@items)\n+\n+    assert_equal \"RealPush Icon Set\", ir.find_by_name(\"RealPush Icon Set\").name\n+    assert_instance_of Time, ir.find_by_name(\"Glitter Scrabble Frames\").created_at\n+    assert_equal \"Free standing wooden letters, 15cm, any colour.\", ir.find_by_name(\"Free Standing Wooden Letters\").description\n+    assert_nil ir.find_by_name(\"My Little Pony\")\n+  end\n+\n+  def test_can_find_all_with_description\n+    ir = ItemRepository.new(@items)\n+\n+    assert_instance_of Array, ir.find_all_with_description(\"tt\")\n+    assert_equal [], ir.find_all_with_description(\"akira\")\n+    assert_instance_of Item, ir.find_all_with_description(\"wri\")[0]\n+    assert_equal \"RealPush Icon Set\", ir.find_all_with_description(\"wri\")[0].name\n+    assert_equal 12334185, ir.find_all_with_description(\"olour\")[0].merchant_id\n+    assert_equal 12334105, ir.find_all_with_description(\"olour\")[1].merchant_id\n+  end\n+\n+  def test_can_find_by_price\n+    ir = ItemRepository.new(@items)\n+\n+    assert_equal \"Free Standing Wooden Letters\", ir.find_all_by_price(7.0)[0].name\n+    assert_equal \"Any colour glitter.\", ir.find_all_by_price(13.0)[0].description\n+  end\n+\n+  def test_can_find_all_by_price_in_range\n+    ir = ItemRepository.new(@items)\n+\n+    assert_instance_of Item, ir.find_all_by_price_in_range(12.0..13.0)[0]\n+  end\n+\n+  def test_item_can_be_found_with_merchant_id\n+    ir = ItemRepository.new(@items)\n+    assert_equal \"Glitter Scrabble Frames\", ir.find_all_by_merchant_id(12334185)[0].name\n+    assert_equal \"Any colour glitter.\", ir.find_all_by_merchant_id(12334185)[0].description\n+    assert_equal 263395617, ir.find_all_by_merchant_id(12334185)[0].id\n+    assert_equal [], ir.find_all_by_merchant_id(33333333)\n+  end\n+\n+  def test_item_can_be_created\n+\n+    ir = ItemRepository.new(@items)\n+\n+    ir.create({\n+      # id: 263395238,\n+      name: \"Bootees\",\n+      description: \"Gorgeous hand knitted baby bootees.\",\n+      unit_price: BigDecimal.new(12.00, 4),\n+      merchant_id: 12334271,\n+      created_at: Time.now,\n+      updated_at: Time.now\n+    })\n+    assert_instance_of Item, ir.find_by_id(263396014)\n+  end\n+\n+  def test_find_highest_id\n+      ir = ItemRepository.new(@items)\n+      assert_equal 263396013, ir.find_highest_id\n+  end\n+\n+\n+  def test_item_can_be_updated\n+\n+    ir = ItemRepository.new(@items)\n+    assert_instance_of Item, ir.all[0]\n+    assert_instance_of Item, ir.find_by_id(263395237)\n+    attributes = {name: \"RealPush Icon Set\",\n+    description: \"It writes things.\",\n+    unit_price: BigDecimal.new(12.00, 4),\n+    merchant_id: 12334141,\n+    created_at: Time.now,\n+    updated_at: Time.now}\n+    ir.update(263395237, attributes)\n+    assert_equal \"It writes things.\", ir.find_by_id(263395237).description\n+    assert_equal \"RealPush Icon Set\", ir.find_by_id(263395237).name\n+    assert_equal 12334141, ir.find_by_id(263395237).merchant_id","path":"test/item_repository_test.rb","position":154,"original_position":154,"commit_id":"e7142763de5d69d3a5762b3c03afb8cea0800beb","original_commit_id":"e7142763de5d69d3a5762b3c03afb8cea0800beb","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Style/NumericLiterals: Use underscores(_) as decimal mark and separate every 3 digits with them.","created_at":"2018-04-10T23:08:52Z","updated_at":"2018-04-10T23:08:53Z","html_url":"https://github.com/zdcthomas/black_thursday/pull/2#discussion_r180593613","pull_request_url":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/2","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/comments/180593613"},"html":{"href":"https://github.com/zdcthomas/black_thursday/pull/2#discussion_r180593613"},"pull_request":{"href":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/2","id":180751390,"html_url":"https://github.com/zdcthomas/black_thursday/pull/2","diff_url":"https://github.com/zdcthomas/black_thursday/pull/2.diff","patch_url":"https://github.com/zdcthomas/black_thursday/pull/2.patch","issue_url":"https://api.github.com/repos/zdcthomas/black_thursday/issues/2","number":2,"state":"open","locked":false,"title":"Itemrepository","user":{"login":"zdcthomas","id":36716240,"avatar_url":"https://avatars1.githubusercontent.com/u/36716240?v=4","gravatar_id":"","url":"https://api.github.com/users/zdcthomas","html_url":"https://github.com/zdcthomas","followers_url":"https://api.github.com/users/zdcthomas/followers","following_url":"https://api.github.com/users/zdcthomas/following{/other_user}","gists_url":"https://api.github.com/users/zdcthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/zdcthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdcthomas/subscriptions","organizations_url":"https://api.github.com/users/zdcthomas/orgs","repos_url":"https://api.github.com/users/zdcthomas/repos","events_url":"https://api.github.com/users/zdcthomas/events{/privacy}","received_events_url":"https://api.github.com/users/zdcthomas/received_events","type":"User","site_admin":false},"body":"creates itemrepository and changes item class","created_at":"2018-04-10T23:08:42Z","updated_at":"2018-04-10T23:08:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/2/commits","review_comments_url":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/2/comments","review_comment_url":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zdcthomas/black_thursday/issues/2/comments","statuses_url":"https://api.github.com/repos/zdcthomas/black_thursday/statuses/e7142763de5d69d3a5762b3c03afb8cea0800beb","head":{"label":"zdcthomas:itemrepository","ref":"itemrepository","sha":"e7142763de5d69d3a5762b3c03afb8cea0800beb","user":{"login":"zdcthomas","id":36716240,"avatar_url":"https://avatars1.githubusercontent.com/u/36716240?v=4","gravatar_id":"","url":"https://api.github.com/users/zdcthomas","html_url":"https://github.com/zdcthomas","followers_url":"https://api.github.com/users/zdcthomas/followers","following_url":"https://api.github.com/users/zdcthomas/following{/other_user}","gists_url":"https://api.github.com/users/zdcthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/zdcthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdcthomas/subscriptions","organizations_url":"https://api.github.com/users/zdcthomas/orgs","repos_url":"https://api.github.com/users/zdcthomas/repos","events_url":"https://api.github.com/users/zdcthomas/events{/privacy}","received_events_url":"https://api.github.com/users/zdcthomas/received_events","type":"User","site_admin":false},"repo":{"id":128444822,"name":"black_thursday","full_name":"zdcthomas/black_thursday","owner":{"login":"zdcthomas","id":36716240,"avatar_url":"https://avatars1.githubusercontent.com/u/36716240?v=4","gravatar_id":"","url":"https://api.github.com/users/zdcthomas","html_url":"https://github.com/zdcthomas","followers_url":"https://api.github.com/users/zdcthomas/followers","following_url":"https://api.github.com/users/zdcthomas/following{/other_user}","gists_url":"https://api.github.com/users/zdcthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/zdcthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdcthomas/subscriptions","organizations_url":"https://api.github.com/users/zdcthomas/orgs","repos_url":"https://api.github.com/users/zdcthomas/repos","events_url":"https://api.github.com/users/zdcthomas/events{/privacy}","received_events_url":"https://api.github.com/users/zdcthomas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zdcthomas/black_thursday","description":null,"fork":true,"url":"https://api.github.com/repos/zdcthomas/black_thursday","forks_url":"https://api.github.com/repos/zdcthomas/black_thursday/forks","keys_url":"https://api.github.com/repos/zdcthomas/black_thursday/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zdcthomas/black_thursday/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zdcthomas/black_thursday/teams","hooks_url":"https://api.github.com/repos/zdcthomas/black_thursday/hooks","issue_events_url":"https://api.github.com/repos/zdcthomas/black_thursday/issues/events{/number}","events_url":"https://api.github.com/repos/zdcthomas/black_thursday/events","assignees_url":"https://api.github.com/repos/zdcthomas/black_thursday/assignees{/user}","branches_url":"https://api.github.com/repos/zdcthomas/black_thursday/branches{/branch}","tags_url":"https://api.github.com/repos/zdcthomas/black_thursday/tags","blobs_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/refs{/sha}","trees_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zdcthomas/black_thursday/statuses/{sha}","languages_url":"https://api.github.com/repos/zdcthomas/black_thursday/languages","stargazers_url":"https://api.github.com/repos/zdcthomas/black_thursday/stargazers","contributors_url":"https://api.github.com/repos/zdcthomas/black_thursday/contributors","subscribers_url":"https://api.github.com/repos/zdcthomas/black_thursday/subscribers","subscription_url":"https://api.github.com/repos/zdcthomas/black_thursday/subscription","commits_url":"https://api.github.com/repos/zdcthomas/black_thursday/commits{/sha}","git_commits_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/commits{/sha}","comments_url":"https://api.github.com/repos/zdcthomas/black_thursday/comments{/number}","issue_comment_url":"https://api.github.com/repos/zdcthomas/black_thursday/issues/comments{/number}","contents_url":"https://api.github.com/repos/zdcthomas/black_thursday/contents/{+path}","compare_url":"https://api.github.com/repos/zdcthomas/black_thursday/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zdcthomas/black_thursday/merges","archive_url":"https://api.github.com/repos/zdcthomas/black_thursday/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zdcthomas/black_thursday/downloads","issues_url":"https://api.github.com/repos/zdcthomas/black_thursday/issues{/number}","pulls_url":"https://api.github.com/repos/zdcthomas/black_thursday/pulls{/number}","milestones_url":"https://api.github.com/repos/zdcthomas/black_thursday/milestones{/number}","notifications_url":"https://api.github.com/repos/zdcthomas/black_thursday/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zdcthomas/black_thursday/labels{/name}","releases_url":"https://api.github.com/repos/zdcthomas/black_thursday/releases{/id}","deployments_url":"https://api.github.com/repos/zdcthomas/black_thursday/deployments","created_at":"2018-04-06T18:54:51Z","updated_at":"2018-04-06T18:54:53Z","pushed_at":"2018-04-10T23:08:42Z","git_url":"git://github.com/zdcthomas/black_thursday.git","ssh_url":"git@github.com:zdcthomas/black_thursday.git","clone_url":"https://github.com/zdcthomas/black_thursday.git","svn_url":"https://github.com/zdcthomas/black_thursday","homepage":null,"size":1796,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"zdcthomas:iteration0","ref":"iteration0","sha":"10d1801cdd3c367d1e87f3e68f943d54f8609bff","user":{"login":"zdcthomas","id":36716240,"avatar_url":"https://avatars1.githubusercontent.com/u/36716240?v=4","gravatar_id":"","url":"https://api.github.com/users/zdcthomas","html_url":"https://github.com/zdcthomas","followers_url":"https://api.github.com/users/zdcthomas/followers","following_url":"https://api.github.com/users/zdcthomas/following{/other_user}","gists_url":"https://api.github.com/users/zdcthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/zdcthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdcthomas/subscriptions","organizations_url":"https://api.github.com/users/zdcthomas/orgs","repos_url":"https://api.github.com/users/zdcthomas/repos","events_url":"https://api.github.com/users/zdcthomas/events{/privacy}","received_events_url":"https://api.github.com/users/zdcthomas/received_events","type":"User","site_admin":false},"repo":{"id":128444822,"name":"black_thursday","full_name":"zdcthomas/black_thursday","owner":{"login":"zdcthomas","id":36716240,"avatar_url":"https://avatars1.githubusercontent.com/u/36716240?v=4","gravatar_id":"","url":"https://api.github.com/users/zdcthomas","html_url":"https://github.com/zdcthomas","followers_url":"https://api.github.com/users/zdcthomas/followers","following_url":"https://api.github.com/users/zdcthomas/following{/other_user}","gists_url":"https://api.github.com/users/zdcthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/zdcthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdcthomas/subscriptions","organizations_url":"https://api.github.com/users/zdcthomas/orgs","repos_url":"https://api.github.com/users/zdcthomas/repos","events_url":"https://api.github.com/users/zdcthomas/events{/privacy}","received_events_url":"https://api.github.com/users/zdcthomas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zdcthomas/black_thursday","description":null,"fork":true,"url":"https://api.github.com/repos/zdcthomas/black_thursday","forks_url":"https://api.github.com/repos/zdcthomas/black_thursday/forks","keys_url":"https://api.github.com/repos/zdcthomas/black_thursday/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zdcthomas/black_thursday/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zdcthomas/black_thursday/teams","hooks_url":"https://api.github.com/repos/zdcthomas/black_thursday/hooks","issue_events_url":"https://api.github.com/repos/zdcthomas/black_thursday/issues/events{/number}","events_url":"https://api.github.com/repos/zdcthomas/black_thursday/events","assignees_url":"https://api.github.com/repos/zdcthomas/black_thursday/assignees{/user}","branches_url":"https://api.github.com/repos/zdcthomas/black_thursday/branches{/branch}","tags_url":"https://api.github.com/repos/zdcthomas/black_thursday/tags","blobs_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/refs{/sha}","trees_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zdcthomas/black_thursday/statuses/{sha}","languages_url":"https://api.github.com/repos/zdcthomas/black_thursday/languages","stargazers_url":"https://api.github.com/repos/zdcthomas/black_thursday/stargazers","contributors_url":"https://api.github.com/repos/zdcthomas/black_thursday/contributors","subscribers_url":"https://api.github.com/repos/zdcthomas/black_thursday/subscribers","subscription_url":"https://api.github.com/repos/zdcthomas/black_thursday/subscription","commits_url":"https://api.github.com/repos/zdcthomas/black_thursday/commits{/sha}","git_commits_url":"https://api.github.com/repos/zdcthomas/black_thursday/git/commits{/sha}","comments_url":"https://api.github.com/repos/zdcthomas/black_thursday/comments{/number}","issue_comment_url":"https://api.github.com/repos/zdcthomas/black_thursday/issues/comments{/number}","contents_url":"https://api.github.com/repos/zdcthomas/black_thursday/contents/{+path}","compare_url":"https://api.github.com/repos/zdcthomas/black_thursday/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zdcthomas/black_thursday/merges","archive_url":"https://api.github.com/repos/zdcthomas/black_thursday/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zdcthomas/black_thursday/downloads","issues_url":"https://api.github.com/repos/zdcthomas/black_thursday/issues{/number}","pulls_url":"https://api.github.com/repos/zdcthomas/black_thursday/pulls{/number}","milestones_url":"https://api.github.com/repos/zdcthomas/black_thursday/milestones{/number}","notifications_url":"https://api.github.com/repos/zdcthomas/black_thursday/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zdcthomas/black_thursday/labels{/name}","releases_url":"https://api.github.com/repos/zdcthomas/black_thursday/releases{/id}","deployments_url":"https://api.github.com/repos/zdcthomas/black_thursday/deployments","created_at":"2018-04-06T18:54:51Z","updated_at":"2018-04-06T18:54:53Z","pushed_at":"2018-04-10T23:08:42Z","git_url":"git://github.com/zdcthomas/black_thursday.git","ssh_url":"git@github.com:zdcthomas/black_thursday.git","clone_url":"https://github.com/zdcthomas/black_thursday.git","svn_url":"https://github.com/zdcthomas/black_thursday","homepage":null,"size":1796,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/2"},"html":{"href":"https://github.com/zdcthomas/black_thursday/pull/2"},"issue":{"href":"https://api.github.com/repos/zdcthomas/black_thursday/issues/2"},"comments":{"href":"https://api.github.com/repos/zdcthomas/black_thursday/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zdcthomas/black_thursday/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/zdcthomas/black_thursday/statuses/e7142763de5d69d3a5762b3c03afb8cea0800beb"}},"author_association":"OWNER"}}
{"actor":{"display_login":"houndci-bot"}}