{"action":"created","comment":{"url":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/comments/89042887","pull_request_review_id":9594315,"id":89042887,"diff_hunk":"@@ -0,0 +1,116 @@\n+require 'rails_helper'\n+\n+RSpec.describe User, type: :model do\n+  before :each do\n+    @slack_bot = create(:slack_bot, :with_messages)\n+  end\n+\n+  describe '#setup_client' do\n+    it \"should create a new slack client with the the bot's api token\" do\n+      Slack::Web::Client.stub(:new)\n+      @slack_bot.setup_client\n+      Slack::Web::Client.should have_received(:new).with(token: @slack_bot.api_token)\n+    end\n+  end\n+\n+  describe '#send_message' do\n+    it 'should call the message of the given type with the remaining arguments' do\n+      @slack_bot.stub(:send_grocery_receipt)\n+      grocery = instance_double('Grocery')\n+      type = SlackMessage::SEND_GROCERY_RECEIPT\n+\n+      @slack_bot.send_message(SlackMessage::SEND_GROCERY_RECEIPT, grocery)\n+\n+      @slack_bot.should have_received(:send_grocery_receipt).with(\n+        @slack_bot.slack_messages.find_by_message_type(type).format,\n+        grocery\n+      )\n+    end\n+  end\n+\n+  describe '#enabled?' do\n+    context 'with a message of the requested type' do\n+      it 'should return true' do\n+        expect(@slack_bot.enabled?(SlackMessage::SEND_GROCERY_RECEIPT)).to eq true\n+      end\n+    end\n+\n+    context 'without a message of the requested type' do\n+      it 'should return false' do\n+        @slack_bot.slack_messages.clear\n+        expect(@slack_bot.enabled?(SlackMessage::SEND_GROCERY_RECEIPT)).to eq false\n+      end\n+    end\n+  end\n+\n+  describe '#post_message' do\n+    it 'should post to general with all keys substituted by the formatted values' do\n+      url = 'https://slack.com/api/chat.postMessage'\n+      stub_request(:post, url).to_return(\n+        status: 200,\n+        headers: {},\n+        # slack-client-ruby requires a body with ok true returned\n+        # in order to not throw an error\n+        body: { ok: true }.to_json,\n+      )\n+\n+      @slack_bot.send(\n+        :post_message,\n+        'This is a {test} of {substitution}',\n+        { test: 'working example', substitution: 'the tests passing' }\n+      )\n+      expect(WebMock).to have_requested(:post, url).with(\n+        body: {\n+          as_user: \"true\",\n+          channel: '#general',\n+          text: 'This is a working example of the tests passing',\n+          token: ''\n+        }\n+      )\n+    end\n+  end\n+\n+  describe '#send_grocery_receipt' do\n+    it 'should post a receipt message with the receipt url' do\n+      url = 'https://test.com'\n+      format = @slack_bot.slack_messages\n+        .find_by_message_type(SlackMessage::SEND_GROCERY_RECEIPT).format\n+      @slack_bot.stub(:post_message)\n+      grocery = instance_double('Grocery')\n+      allow(grocery).to receive_message_chain(:receipt, :url).and_return(url)\n+\n+      @slack_bot.send(:send_grocery_receipt, format, grocery)\n+\n+      @slack_bot.should have_received(:post_message).with(format, { url: url })","path":"spec/models/slack_bot_spec.rb","position":84,"original_position":84,"commit_id":"09d302790cc79c9eebd54f0844c24d029ebd9cb8","original_commit_id":"09d302790cc79c9eebd54f0844c24d029ebd9cb8","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","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":"Redundant curly braces around a hash parameter.","created_at":"2016-11-22T04:46:11Z","updated_at":"2016-11-22T04:46:11Z","html_url":"https://github.com/danReynolds/SupermarKit/pull/139#discussion_r89042887","pull_request_url":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/139","_links":{"self":{"href":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/comments/89042887"},"html":{"href":"https://github.com/danReynolds/SupermarKit/pull/139#discussion_r89042887"},"pull_request":{"href":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/139"}}},"pull_request":{"url":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/139","id":94747586,"html_url":"https://github.com/danReynolds/SupermarKit/pull/139","diff_url":"https://github.com/danReynolds/SupermarKit/pull/139.diff","patch_url":"https://github.com/danReynolds/SupermarKit/pull/139.patch","issue_url":"https://api.github.com/repos/danReynolds/SupermarKit/issues/139","number":139,"state":"open","locked":false,"title":"Feature/add slack tests","user":{"login":"danReynolds","id":2192930,"avatar_url":"https://avatars.githubusercontent.com/u/2192930?v=3","gravatar_id":"","url":"https://api.github.com/users/danReynolds","html_url":"https://github.com/danReynolds","followers_url":"https://api.github.com/users/danReynolds/followers","following_url":"https://api.github.com/users/danReynolds/following{/other_user}","gists_url":"https://api.github.com/users/danReynolds/gists{/gist_id}","starred_url":"https://api.github.com/users/danReynolds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danReynolds/subscriptions","organizations_url":"https://api.github.com/users/danReynolds/orgs","repos_url":"https://api.github.com/users/danReynolds/repos","events_url":"https://api.github.com/users/danReynolds/events{/privacy}","received_events_url":"https://api.github.com/users/danReynolds/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-22T04:46:01Z","updated_at":"2016-11-22T04:46:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a79681a035f34ff7590821ed3d299eefcc892a21","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/139/commits","review_comments_url":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/139/comments","review_comment_url":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/danReynolds/SupermarKit/issues/139/comments","statuses_url":"https://api.github.com/repos/danReynolds/SupermarKit/statuses/09d302790cc79c9eebd54f0844c24d029ebd9cb8","head":{"label":"danReynolds:feature/addSlackTests","ref":"feature/addSlackTests","sha":"09d302790cc79c9eebd54f0844c24d029ebd9cb8","user":{"login":"danReynolds","id":2192930,"avatar_url":"https://avatars.githubusercontent.com/u/2192930?v=3","gravatar_id":"","url":"https://api.github.com/users/danReynolds","html_url":"https://github.com/danReynolds","followers_url":"https://api.github.com/users/danReynolds/followers","following_url":"https://api.github.com/users/danReynolds/following{/other_user}","gists_url":"https://api.github.com/users/danReynolds/gists{/gist_id}","starred_url":"https://api.github.com/users/danReynolds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danReynolds/subscriptions","organizations_url":"https://api.github.com/users/danReynolds/orgs","repos_url":"https://api.github.com/users/danReynolds/repos","events_url":"https://api.github.com/users/danReynolds/events{/privacy}","received_events_url":"https://api.github.com/users/danReynolds/received_events","type":"User","site_admin":false},"repo":{"id":27952521,"name":"SupermarKit","full_name":"danReynolds/SupermarKit","owner":{"login":"danReynolds","id":2192930,"avatar_url":"https://avatars.githubusercontent.com/u/2192930?v=3","gravatar_id":"","url":"https://api.github.com/users/danReynolds","html_url":"https://github.com/danReynolds","followers_url":"https://api.github.com/users/danReynolds/followers","following_url":"https://api.github.com/users/danReynolds/following{/other_user}","gists_url":"https://api.github.com/users/danReynolds/gists{/gist_id}","starred_url":"https://api.github.com/users/danReynolds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danReynolds/subscriptions","organizations_url":"https://api.github.com/users/danReynolds/orgs","repos_url":"https://api.github.com/users/danReynolds/repos","events_url":"https://api.github.com/users/danReynolds/events{/privacy}","received_events_url":"https://api.github.com/users/danReynolds/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danReynolds/SupermarKit","description":"SupermarKit - a grocery tracking and management app","fork":false,"url":"https://api.github.com/repos/danReynolds/SupermarKit","forks_url":"https://api.github.com/repos/danReynolds/SupermarKit/forks","keys_url":"https://api.github.com/repos/danReynolds/SupermarKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danReynolds/SupermarKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danReynolds/SupermarKit/teams","hooks_url":"https://api.github.com/repos/danReynolds/SupermarKit/hooks","issue_events_url":"https://api.github.com/repos/danReynolds/SupermarKit/issues/events{/number}","events_url":"https://api.github.com/repos/danReynolds/SupermarKit/events","assignees_url":"https://api.github.com/repos/danReynolds/SupermarKit/assignees{/user}","branches_url":"https://api.github.com/repos/danReynolds/SupermarKit/branches{/branch}","tags_url":"https://api.github.com/repos/danReynolds/SupermarKit/tags","blobs_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danReynolds/SupermarKit/statuses/{sha}","languages_url":"https://api.github.com/repos/danReynolds/SupermarKit/languages","stargazers_url":"https://api.github.com/repos/danReynolds/SupermarKit/stargazers","contributors_url":"https://api.github.com/repos/danReynolds/SupermarKit/contributors","subscribers_url":"https://api.github.com/repos/danReynolds/SupermarKit/subscribers","subscription_url":"https://api.github.com/repos/danReynolds/SupermarKit/subscription","commits_url":"https://api.github.com/repos/danReynolds/SupermarKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/danReynolds/SupermarKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/danReynolds/SupermarKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/danReynolds/SupermarKit/contents/{+path}","compare_url":"https://api.github.com/repos/danReynolds/SupermarKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danReynolds/SupermarKit/merges","archive_url":"https://api.github.com/repos/danReynolds/SupermarKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danReynolds/SupermarKit/downloads","issues_url":"https://api.github.com/repos/danReynolds/SupermarKit/issues{/number}","pulls_url":"https://api.github.com/repos/danReynolds/SupermarKit/pulls{/number}","milestones_url":"https://api.github.com/repos/danReynolds/SupermarKit/milestones{/number}","notifications_url":"https://api.github.com/repos/danReynolds/SupermarKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danReynolds/SupermarKit/labels{/name}","releases_url":"https://api.github.com/repos/danReynolds/SupermarKit/releases{/id}","deployments_url":"https://api.github.com/repos/danReynolds/SupermarKit/deployments","created_at":"2014-12-13T06:56:32Z","updated_at":"2016-10-28T05:56:19Z","pushed_at":"2016-11-22T04:46:02Z","git_url":"git://github.com/danReynolds/SupermarKit.git","ssh_url":"git@github.com:danReynolds/SupermarKit.git","clone_url":"https://github.com/danReynolds/SupermarKit.git","svn_url":"https://github.com/danReynolds/SupermarKit","homepage":"https://supermarkit.io","size":102423,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":20,"forks":5,"open_issues":20,"watchers":4,"default_branch":"master"}},"base":{"label":"danReynolds:master","ref":"master","sha":"523debdc789c6ef63a8e6cf00b5a66d68bb20892","user":{"login":"danReynolds","id":2192930,"avatar_url":"https://avatars.githubusercontent.com/u/2192930?v=3","gravatar_id":"","url":"https://api.github.com/users/danReynolds","html_url":"https://github.com/danReynolds","followers_url":"https://api.github.com/users/danReynolds/followers","following_url":"https://api.github.com/users/danReynolds/following{/other_user}","gists_url":"https://api.github.com/users/danReynolds/gists{/gist_id}","starred_url":"https://api.github.com/users/danReynolds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danReynolds/subscriptions","organizations_url":"https://api.github.com/users/danReynolds/orgs","repos_url":"https://api.github.com/users/danReynolds/repos","events_url":"https://api.github.com/users/danReynolds/events{/privacy}","received_events_url":"https://api.github.com/users/danReynolds/received_events","type":"User","site_admin":false},"repo":{"id":27952521,"name":"SupermarKit","full_name":"danReynolds/SupermarKit","owner":{"login":"danReynolds","id":2192930,"avatar_url":"https://avatars.githubusercontent.com/u/2192930?v=3","gravatar_id":"","url":"https://api.github.com/users/danReynolds","html_url":"https://github.com/danReynolds","followers_url":"https://api.github.com/users/danReynolds/followers","following_url":"https://api.github.com/users/danReynolds/following{/other_user}","gists_url":"https://api.github.com/users/danReynolds/gists{/gist_id}","starred_url":"https://api.github.com/users/danReynolds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danReynolds/subscriptions","organizations_url":"https://api.github.com/users/danReynolds/orgs","repos_url":"https://api.github.com/users/danReynolds/repos","events_url":"https://api.github.com/users/danReynolds/events{/privacy}","received_events_url":"https://api.github.com/users/danReynolds/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danReynolds/SupermarKit","description":"SupermarKit - a grocery tracking and management app","fork":false,"url":"https://api.github.com/repos/danReynolds/SupermarKit","forks_url":"https://api.github.com/repos/danReynolds/SupermarKit/forks","keys_url":"https://api.github.com/repos/danReynolds/SupermarKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danReynolds/SupermarKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danReynolds/SupermarKit/teams","hooks_url":"https://api.github.com/repos/danReynolds/SupermarKit/hooks","issue_events_url":"https://api.github.com/repos/danReynolds/SupermarKit/issues/events{/number}","events_url":"https://api.github.com/repos/danReynolds/SupermarKit/events","assignees_url":"https://api.github.com/repos/danReynolds/SupermarKit/assignees{/user}","branches_url":"https://api.github.com/repos/danReynolds/SupermarKit/branches{/branch}","tags_url":"https://api.github.com/repos/danReynolds/SupermarKit/tags","blobs_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danReynolds/SupermarKit/statuses/{sha}","languages_url":"https://api.github.com/repos/danReynolds/SupermarKit/languages","stargazers_url":"https://api.github.com/repos/danReynolds/SupermarKit/stargazers","contributors_url":"https://api.github.com/repos/danReynolds/SupermarKit/contributors","subscribers_url":"https://api.github.com/repos/danReynolds/SupermarKit/subscribers","subscription_url":"https://api.github.com/repos/danReynolds/SupermarKit/subscription","commits_url":"https://api.github.com/repos/danReynolds/SupermarKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/danReynolds/SupermarKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/danReynolds/SupermarKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/danReynolds/SupermarKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/danReynolds/SupermarKit/contents/{+path}","compare_url":"https://api.github.com/repos/danReynolds/SupermarKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danReynolds/SupermarKit/merges","archive_url":"https://api.github.com/repos/danReynolds/SupermarKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danReynolds/SupermarKit/downloads","issues_url":"https://api.github.com/repos/danReynolds/SupermarKit/issues{/number}","pulls_url":"https://api.github.com/repos/danReynolds/SupermarKit/pulls{/number}","milestones_url":"https://api.github.com/repos/danReynolds/SupermarKit/milestones{/number}","notifications_url":"https://api.github.com/repos/danReynolds/SupermarKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danReynolds/SupermarKit/labels{/name}","releases_url":"https://api.github.com/repos/danReynolds/SupermarKit/releases{/id}","deployments_url":"https://api.github.com/repos/danReynolds/SupermarKit/deployments","created_at":"2014-12-13T06:56:32Z","updated_at":"2016-10-28T05:56:19Z","pushed_at":"2016-11-22T04:46:02Z","git_url":"git://github.com/danReynolds/SupermarKit.git","ssh_url":"git@github.com:danReynolds/SupermarKit.git","clone_url":"https://github.com/danReynolds/SupermarKit.git","svn_url":"https://github.com/danReynolds/SupermarKit","homepage":"https://supermarkit.io","size":102423,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":20,"forks":5,"open_issues":20,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/139"},"html":{"href":"https://github.com/danReynolds/SupermarKit/pull/139"},"issue":{"href":"https://api.github.com/repos/danReynolds/SupermarKit/issues/139"},"comments":{"href":"https://api.github.com/repos/danReynolds/SupermarKit/issues/139/comments"},"review_comments":{"href":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/139/comments"},"review_comment":{"href":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/danReynolds/SupermarKit/pulls/139/commits"},"statuses":{"href":"https://api.github.com/repos/danReynolds/SupermarKit/statuses/09d302790cc79c9eebd54f0844c24d029ebd9cb8"}}}}
{"actor":{"display_login":"houndci-bot"}}