{"action":"created","comment":{"url":"https://api.github.com/repos/progressions/todoable/pulls/comments/158718760","pull_request_review_id":85567644,"id":158718760,"diff_hunk":"@@ -0,0 +1,119 @@\n+require \"spec_helper\"\n+require \"todoable/item\"\n+require \"todoable/list\"\n+\n+RSpec.describe Todoable::Item do\n+  let(:item_attributes) do\n+    {\n+      \"name\" => \"get dog food\",\n+      \"finished_at\" => nil,\n+      \"src\" => \"http://todoable.teachable.tech/api/lists/123-abc/items/987-zyx\",\n+      \"list_id\" => \"123-abc\",\n+      \"id\" => \"987-zyx\",\n+    }\n+  end\n+  let(:list_attributes) do\n+    {\n+      \"name\" => \"Groceries\",\n+      \"items\" => [\n+        { \"name\" => \"get dog food\",\n+          \"finished_at\" => nil,\n+          \"src\" => \"http://todoable.teachable.tech/api/lists/123-abc/items/987-zyx\",\n+          \"id\" => \"987-zyx\" },\n+        { \"name\" => \"dish soap\",\n+          \"finished_at\" => nil,\n+          \"src\" => \"http://todoable.teachable.tech/api/lists/123-abc/items/654-wvu\",\n+          \"id\" => \"654-wvu\" }\n+      ], \"id\" => \"123-abc\"\n+    }\n+  end\n+  let(:list_with_finished_item_attributes) {\n+    {\n+      \"name\" => \"Groceries\",\n+      \"items\" => [\n+        { \"name\" => \"get dog food\",\n+          \"finished_at\" => \"2017-12-26T01:32:22.268Z\",\n+          \"src\" => \"http://todoable.teachable.tech/api/lists/123-abc/items/987-zyx\",\n+          \"id\" => \"987-zyx\" },\n+        { \"name\" => \"dish soap\",\n+          \"finished_at\" => nil,\n+          \"src\" => \"http://todoable.teachable.tech/api/lists/123-abc/items/654-wvu\",\n+          \"id\" => \"654-wvu\" }\n+      ], \"id\" => \"123-abc\"\n+    }\n+  }\n+\n+\n+  let(:item) { Todoable::Item.new(item_attributes) }\n+  let(:mock_client) { double(\"mock client\") }\n+\n+  before(:each) do\n+    allow(Todoable::Client).to receive(:new).and_return(mock_client)\n+  end\n+\n+  after(:each) do\n+    # Keep the mocked client from sticking around\n+    Todoable::List.instance_variable_set(\"@client\", nil)\n+    Todoable::Item.instance_variable_set(\"@client\", nil)\n+  end\n+\n+  describe \"#finish!\" do\n+    it \"sends request to finish the Item\" do\n+      allow(mock_client).to receive(:get_list).with(id: \"123-abc\").and_return(list_attributes, list_with_finished_item_attributes)\n+      expect(mock_client).to receive(:finish_item).with(list_id: \"123-abc\", id: '987-zyx').and_return(\"get dog food finished\")\n+      item.finish!\n+    end\n+  end\n+\n+  describe \"#finished?\" do\n+    it \"returns true if Item has a finished_at date\" do\n+      item.finished_at = \"2017-12-26T01:32:22.268Z\"\n+      expect(item.finished?).to be_truthy\n+    end\n+\n+    it \"returns false if Item has no finished_at date\" do\n+      item.finished_at = nil\n+      expect(item.finished?).to be_falsey\n+    end\n+  end\n+\n+  describe \"#list\" do\n+    it \"returns nil unless the Item has an associated List\" do\n+      item.list_id = nil\n+      expect(item.list).to be_nil\n+    end\n+\n+    it \"fetches the associated List and instantiates it as a List object\" do\n+      expect(mock_client).to receive(:get_list).with(id: \"123-abc\").and_return(list_attributes)\n+      expect(item.list.name).to eq(\"Groceries\")\n+    end\n+  end\n+\n+  describe \".new\" do\n+    it \"creates a Item object in memory\" do\n+      expect(item.name).to eq(\"get dog food\")\n+    end\n+  end\n+\n+  describe \".create\" do\n+    it \"creates a new Item on the Todoable server\" do\n+      expect(mock_client).to receive(:create_item).with(list_id: \"123-abc\", name: \"get dog food\").and_return(item_attributes)\n+      item = Todoable::Item.create(list_id: \"123-abc\", name: \"get dog food\")\n+      expect(item.name).to eq(\"get dog food\")\n+    end\n+  end\n+\n+  describe \".finish\" do\n+    it \"sends a request to finish the Item on the Todoable server\" do\n+      expect(mock_client).to receive(:finish_item).with(list_id: \"123-abc\", id: \"987-zyx\").and_return(\"get dog food finished\")","path":"spec/todoable/item_spec.rb","position":108,"original_position":108,"commit_id":"d0e24e9c98396ea7a8618b16cf8f4924f921c127","original_commit_id":"d0e24e9c98396ea7a8618b16cf8f4924f921c127","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":"Prefer single-quoted strings when you don't need string interpolation or special symbols.<br>Line is too long. [126/80]","created_at":"2017-12-26T16:13:57Z","updated_at":"2017-12-26T16:13:57Z","html_url":"https://github.com/progressions/todoable/pull/3#discussion_r158718760","pull_request_url":"https://api.github.com/repos/progressions/todoable/pulls/3","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/progressions/todoable/pulls/comments/158718760"},"html":{"href":"https://github.com/progressions/todoable/pull/3#discussion_r158718760"},"pull_request":{"href":"https://api.github.com/repos/progressions/todoable/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/progressions/todoable/pulls/3","id":160144954,"html_url":"https://github.com/progressions/todoable/pull/3","diff_url":"https://github.com/progressions/todoable/pull/3.diff","patch_url":"https://github.com/progressions/todoable/pull/3.patch","issue_url":"https://api.github.com/repos/progressions/todoable/issues/3","number":3,"state":"open","locked":false,"title":"Simplify things.","user":{"login":"progressions","id":18153,"avatar_url":"https://avatars3.githubusercontent.com/u/18153?v=4","gravatar_id":"","url":"https://api.github.com/users/progressions","html_url":"https://github.com/progressions","followers_url":"https://api.github.com/users/progressions/followers","following_url":"https://api.github.com/users/progressions/following{/other_user}","gists_url":"https://api.github.com/users/progressions/gists{/gist_id}","starred_url":"https://api.github.com/users/progressions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/progressions/subscriptions","organizations_url":"https://api.github.com/users/progressions/orgs","repos_url":"https://api.github.com/users/progressions/repos","events_url":"https://api.github.com/users/progressions/events{/privacy}","received_events_url":"https://api.github.com/users/progressions/received_events","type":"User","site_admin":false},"body":"I originally wanted to have a fancy interface where a method could take either an \"id\" argument, or a List object (or Item object), because the List object would respond to the [\"id\"] method, just like an args Hash would.\r\n\r\nThis made the code a little too flowery, so I've simplified it to use keyword arguments consistently.","created_at":"2017-12-26T16:13:39Z","updated_at":"2017-12-26T16:13:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24c8495da758384b2a4b9f64e301594539954c91","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/progressions/todoable/pulls/3/commits","review_comments_url":"https://api.github.com/repos/progressions/todoable/pulls/3/comments","review_comment_url":"https://api.github.com/repos/progressions/todoable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/progressions/todoable/issues/3/comments","statuses_url":"https://api.github.com/repos/progressions/todoable/statuses/d0e24e9c98396ea7a8618b16cf8f4924f921c127","head":{"label":"progressions:simplify","ref":"simplify","sha":"d0e24e9c98396ea7a8618b16cf8f4924f921c127","user":{"login":"progressions","id":18153,"avatar_url":"https://avatars3.githubusercontent.com/u/18153?v=4","gravatar_id":"","url":"https://api.github.com/users/progressions","html_url":"https://github.com/progressions","followers_url":"https://api.github.com/users/progressions/followers","following_url":"https://api.github.com/users/progressions/following{/other_user}","gists_url":"https://api.github.com/users/progressions/gists{/gist_id}","starred_url":"https://api.github.com/users/progressions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/progressions/subscriptions","organizations_url":"https://api.github.com/users/progressions/orgs","repos_url":"https://api.github.com/users/progressions/repos","events_url":"https://api.github.com/users/progressions/events{/privacy}","received_events_url":"https://api.github.com/users/progressions/received_events","type":"User","site_admin":false},"repo":{"id":115146496,"name":"todoable","full_name":"progressions/todoable","owner":{"login":"progressions","id":18153,"avatar_url":"https://avatars3.githubusercontent.com/u/18153?v=4","gravatar_id":"","url":"https://api.github.com/users/progressions","html_url":"https://github.com/progressions","followers_url":"https://api.github.com/users/progressions/followers","following_url":"https://api.github.com/users/progressions/following{/other_user}","gists_url":"https://api.github.com/users/progressions/gists{/gist_id}","starred_url":"https://api.github.com/users/progressions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/progressions/subscriptions","organizations_url":"https://api.github.com/users/progressions/orgs","repos_url":"https://api.github.com/users/progressions/repos","events_url":"https://api.github.com/users/progressions/events{/privacy}","received_events_url":"https://api.github.com/users/progressions/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/progressions/todoable","description":null,"fork":false,"url":"https://api.github.com/repos/progressions/todoable","forks_url":"https://api.github.com/repos/progressions/todoable/forks","keys_url":"https://api.github.com/repos/progressions/todoable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/progressions/todoable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/progressions/todoable/teams","hooks_url":"https://api.github.com/repos/progressions/todoable/hooks","issue_events_url":"https://api.github.com/repos/progressions/todoable/issues/events{/number}","events_url":"https://api.github.com/repos/progressions/todoable/events","assignees_url":"https://api.github.com/repos/progressions/todoable/assignees{/user}","branches_url":"https://api.github.com/repos/progressions/todoable/branches{/branch}","tags_url":"https://api.github.com/repos/progressions/todoable/tags","blobs_url":"https://api.github.com/repos/progressions/todoable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/progressions/todoable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/progressions/todoable/git/refs{/sha}","trees_url":"https://api.github.com/repos/progressions/todoable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/progressions/todoable/statuses/{sha}","languages_url":"https://api.github.com/repos/progressions/todoable/languages","stargazers_url":"https://api.github.com/repos/progressions/todoable/stargazers","contributors_url":"https://api.github.com/repos/progressions/todoable/contributors","subscribers_url":"https://api.github.com/repos/progressions/todoable/subscribers","subscription_url":"https://api.github.com/repos/progressions/todoable/subscription","commits_url":"https://api.github.com/repos/progressions/todoable/commits{/sha}","git_commits_url":"https://api.github.com/repos/progressions/todoable/git/commits{/sha}","comments_url":"https://api.github.com/repos/progressions/todoable/comments{/number}","issue_comment_url":"https://api.github.com/repos/progressions/todoable/issues/comments{/number}","contents_url":"https://api.github.com/repos/progressions/todoable/contents/{+path}","compare_url":"https://api.github.com/repos/progressions/todoable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/progressions/todoable/merges","archive_url":"https://api.github.com/repos/progressions/todoable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/progressions/todoable/downloads","issues_url":"https://api.github.com/repos/progressions/todoable/issues{/number}","pulls_url":"https://api.github.com/repos/progressions/todoable/pulls{/number}","milestones_url":"https://api.github.com/repos/progressions/todoable/milestones{/number}","notifications_url":"https://api.github.com/repos/progressions/todoable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/progressions/todoable/labels{/name}","releases_url":"https://api.github.com/repos/progressions/todoable/releases{/id}","deployments_url":"https://api.github.com/repos/progressions/todoable/deployments","created_at":"2017-12-22T20:00:07Z","updated_at":"2017-12-22T20:00:23Z","pushed_at":"2017-12-26T16:13:40Z","git_url":"git://github.com/progressions/todoable.git","ssh_url":"git@github.com:progressions/todoable.git","clone_url":"https://github.com/progressions/todoable.git","svn_url":"https://github.com/progressions/todoable","homepage":null,"size":70,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"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":"progressions:master","ref":"master","sha":"e477c05dc4bd7224a8c6bad9925a344d3ea3d1fa","user":{"login":"progressions","id":18153,"avatar_url":"https://avatars3.githubusercontent.com/u/18153?v=4","gravatar_id":"","url":"https://api.github.com/users/progressions","html_url":"https://github.com/progressions","followers_url":"https://api.github.com/users/progressions/followers","following_url":"https://api.github.com/users/progressions/following{/other_user}","gists_url":"https://api.github.com/users/progressions/gists{/gist_id}","starred_url":"https://api.github.com/users/progressions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/progressions/subscriptions","organizations_url":"https://api.github.com/users/progressions/orgs","repos_url":"https://api.github.com/users/progressions/repos","events_url":"https://api.github.com/users/progressions/events{/privacy}","received_events_url":"https://api.github.com/users/progressions/received_events","type":"User","site_admin":false},"repo":{"id":115146496,"name":"todoable","full_name":"progressions/todoable","owner":{"login":"progressions","id":18153,"avatar_url":"https://avatars3.githubusercontent.com/u/18153?v=4","gravatar_id":"","url":"https://api.github.com/users/progressions","html_url":"https://github.com/progressions","followers_url":"https://api.github.com/users/progressions/followers","following_url":"https://api.github.com/users/progressions/following{/other_user}","gists_url":"https://api.github.com/users/progressions/gists{/gist_id}","starred_url":"https://api.github.com/users/progressions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/progressions/subscriptions","organizations_url":"https://api.github.com/users/progressions/orgs","repos_url":"https://api.github.com/users/progressions/repos","events_url":"https://api.github.com/users/progressions/events{/privacy}","received_events_url":"https://api.github.com/users/progressions/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/progressions/todoable","description":null,"fork":false,"url":"https://api.github.com/repos/progressions/todoable","forks_url":"https://api.github.com/repos/progressions/todoable/forks","keys_url":"https://api.github.com/repos/progressions/todoable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/progressions/todoable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/progressions/todoable/teams","hooks_url":"https://api.github.com/repos/progressions/todoable/hooks","issue_events_url":"https://api.github.com/repos/progressions/todoable/issues/events{/number}","events_url":"https://api.github.com/repos/progressions/todoable/events","assignees_url":"https://api.github.com/repos/progressions/todoable/assignees{/user}","branches_url":"https://api.github.com/repos/progressions/todoable/branches{/branch}","tags_url":"https://api.github.com/repos/progressions/todoable/tags","blobs_url":"https://api.github.com/repos/progressions/todoable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/progressions/todoable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/progressions/todoable/git/refs{/sha}","trees_url":"https://api.github.com/repos/progressions/todoable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/progressions/todoable/statuses/{sha}","languages_url":"https://api.github.com/repos/progressions/todoable/languages","stargazers_url":"https://api.github.com/repos/progressions/todoable/stargazers","contributors_url":"https://api.github.com/repos/progressions/todoable/contributors","subscribers_url":"https://api.github.com/repos/progressions/todoable/subscribers","subscription_url":"https://api.github.com/repos/progressions/todoable/subscription","commits_url":"https://api.github.com/repos/progressions/todoable/commits{/sha}","git_commits_url":"https://api.github.com/repos/progressions/todoable/git/commits{/sha}","comments_url":"https://api.github.com/repos/progressions/todoable/comments{/number}","issue_comment_url":"https://api.github.com/repos/progressions/todoable/issues/comments{/number}","contents_url":"https://api.github.com/repos/progressions/todoable/contents/{+path}","compare_url":"https://api.github.com/repos/progressions/todoable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/progressions/todoable/merges","archive_url":"https://api.github.com/repos/progressions/todoable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/progressions/todoable/downloads","issues_url":"https://api.github.com/repos/progressions/todoable/issues{/number}","pulls_url":"https://api.github.com/repos/progressions/todoable/pulls{/number}","milestones_url":"https://api.github.com/repos/progressions/todoable/milestones{/number}","notifications_url":"https://api.github.com/repos/progressions/todoable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/progressions/todoable/labels{/name}","releases_url":"https://api.github.com/repos/progressions/todoable/releases{/id}","deployments_url":"https://api.github.com/repos/progressions/todoable/deployments","created_at":"2017-12-22T20:00:07Z","updated_at":"2017-12-22T20:00:23Z","pushed_at":"2017-12-26T16:13:40Z","git_url":"git://github.com/progressions/todoable.git","ssh_url":"git@github.com:progressions/todoable.git","clone_url":"https://github.com/progressions/todoable.git","svn_url":"https://github.com/progressions/todoable","homepage":null,"size":70,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"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/progressions/todoable/pulls/3"},"html":{"href":"https://github.com/progressions/todoable/pull/3"},"issue":{"href":"https://api.github.com/repos/progressions/todoable/issues/3"},"comments":{"href":"https://api.github.com/repos/progressions/todoable/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/progressions/todoable/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/progressions/todoable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/progressions/todoable/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/progressions/todoable/statuses/d0e24e9c98396ea7a8618b16cf8f4924f921c127"}},"author_association":"OWNER"}}
{"actor":{"display_login":"houndci-bot"}}