{"action":"created","comment":{"url":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/comments/180451097","pull_request_review_id":110872654,"id":180451097,"diff_hunk":"@@ -0,0 +1,125 @@\n+require 'spec_helper'\n+require 'slack'\n+require './app/services/slack_integration/invite_user'\n+require './app/services/slack_service'\n+\n+describe SlackService do\n+  subject { described_class.new(token) }\n+  let(:token) { '123456' }\n+\n+  describe '#invite' do\n+    let(:email)      { 'user@test.com' }\n+    let(:first_name) { 'John' }\n+    let(:last_name)  { 'Smith' }\n+\n+    it 'calls SlackIntegration::InviteUser class' do\n+      invite_service = double\n+      allow(invite_service).to receive(:call)\n+      allow(SlackIntegration::InviteUser).to receive(:new)\n+        .with(email: email, first_name: first_name, last_name: last_name, token: token)\n+        .and_return(invite_service)\n+      subject.invite(email, first_name, last_name)\n+    end\n+  end\n+\n+  describe 'slack gem wrappers' do\n+    let(:client) { double }\n+\n+    before { allow_any_instance_of(described_class).to receive(:client).and_return(client) }\n+\n+    describe '#post_to_channel' do\n+      let(:channel) { 'channel' }\n+      let(:message) { 'message' }\n+\n+      it 'calls postMessage method' do\n+        expect(client).to receive(:chat_postMessage)\n+          .with(channel: channel, text: message, as_user: false, username: 'Idea Bot')\n+          .once \n+        subject.post_to_channel(channel, message)\n+      end\n+    end\n+\n+    describe '#invite_to_channel' do\n+      let(:channel) { 'channel' }\n+      let(:email)   { 'email' }\n+\n+      before do\n+        allow(client).to receive(:conversations_list).and_return(channels_data)\n+        allow(client).to receive(:users_list).and_return(users_data)\n+      end\n+\n+      context 'channel and user exists' do\n+        let(:users_data) do\n+          { 'members' => [\n+              { 'id' => '1', 'profile' => { 'email' => 'email1' }},\n+              { 'id' => '2', 'profile' => { 'email' => 'email' }}\n+            ]\n+          }\n+        end\n+\n+        let(:channels_data) do\n+          {'channels' => [\n+            { 'id' => '1', 'name' => 'channel1' },\n+            { 'id' => '2', 'name' => 'channel' }\n+          ]}\n+        end\n+\n+        it 'calls coversations_invite with proper args' do\n+          expect(client).to receive(:conversations_invite).with(channel: '2', users: '2').once\n+          subject.invite_to_channel(channel, email)\n+        end\n+      end\n+\n+      context 'user does not exist in slack' do\n+        let(:users_data) do\n+          { 'members' => [\n+              { 'id' => '1', 'profile' => { 'email' => 'email1' }}\n+            ]\n+          }\n+        end\n+\n+        let(:channels_data) do\n+          {'channels' => [\n+            { 'id' => '1', 'name' => 'channel1' },\n+            { 'id' => '2', 'name' => 'channel' }\n+          ]}\n+        end\n+\n+        it 'raises error' do\n+          expect { subject.invite_to_channel(channel, email) }.to raise_error(SlackIntegration::FailedApiCallException)\n+        end\n+      end\n+\n+      context 'channel does not exist in slack' do\n+        let(:users_data) do\n+          { 'members' => [\n+              { 'id' => '1', 'profile' => { 'email' => 'email1' }},\n+              { 'id' => '2', 'profile' => { 'email' => 'email' }}\n+            ]","path":"spec/services/slack_service_spec.rb","position":56,"original_position":98,"commit_id":"74d6b77938ff3aced0374d603878f7576264f719","original_commit_id":"74d6b77938ff3aced0374d603878f7576264f719","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":"Layout/IndentArray: Indent the right bracket the same as the start of the line where the left bracket is.","created_at":"2018-04-10T14:52:07Z","updated_at":"2018-04-10T14:52:08Z","html_url":"https://github.com/howtohireme/give-me-poc/pull/33#discussion_r180451097","pull_request_url":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/33","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/comments/180451097"},"html":{"href":"https://github.com/howtohireme/give-me-poc/pull/33#discussion_r180451097"},"pull_request":{"href":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/33","id":180629416,"html_url":"https://github.com/howtohireme/give-me-poc/pull/33","diff_url":"https://github.com/howtohireme/give-me-poc/pull/33.diff","patch_url":"https://github.com/howtohireme/give-me-poc/pull/33.patch","issue_url":"https://api.github.com/repos/howtohireme/give-me-poc/issues/33","number":33,"state":"open","locked":false,"title":"Slack integration","user":{"login":"Mehonoshin","id":525961,"avatar_url":"https://avatars3.githubusercontent.com/u/525961?v=4","gravatar_id":"","url":"https://api.github.com/users/Mehonoshin","html_url":"https://github.com/Mehonoshin","followers_url":"https://api.github.com/users/Mehonoshin/followers","following_url":"https://api.github.com/users/Mehonoshin/following{/other_user}","gists_url":"https://api.github.com/users/Mehonoshin/gists{/gist_id}","starred_url":"https://api.github.com/users/Mehonoshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mehonoshin/subscriptions","organizations_url":"https://api.github.com/users/Mehonoshin/orgs","repos_url":"https://api.github.com/users/Mehonoshin/repos","events_url":"https://api.github.com/users/Mehonoshin/events{/privacy}","received_events_url":"https://api.github.com/users/Mehonoshin/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-10T14:51:55Z","updated_at":"2018-04-10T14:52:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bc472b82e6abaf5be4329ba1e2d936f580f0461","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/33/commits","review_comments_url":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/33/comments","review_comment_url":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/howtohireme/give-me-poc/issues/33/comments","statuses_url":"https://api.github.com/repos/howtohireme/give-me-poc/statuses/74d6b77938ff3aced0374d603878f7576264f719","head":{"label":"howtohireme:slack-integration","ref":"slack-integration","sha":"74d6b77938ff3aced0374d603878f7576264f719","user":{"login":"howtohireme","id":33529654,"avatar_url":"https://avatars1.githubusercontent.com/u/33529654?v=4","gravatar_id":"","url":"https://api.github.com/users/howtohireme","html_url":"https://github.com/howtohireme","followers_url":"https://api.github.com/users/howtohireme/followers","following_url":"https://api.github.com/users/howtohireme/following{/other_user}","gists_url":"https://api.github.com/users/howtohireme/gists{/gist_id}","starred_url":"https://api.github.com/users/howtohireme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howtohireme/subscriptions","organizations_url":"https://api.github.com/users/howtohireme/orgs","repos_url":"https://api.github.com/users/howtohireme/repos","events_url":"https://api.github.com/users/howtohireme/events{/privacy}","received_events_url":"https://api.github.com/users/howtohireme/received_events","type":"Organization","site_admin":false},"repo":{"id":117230368,"name":"give-me-poc","full_name":"howtohireme/give-me-poc","owner":{"login":"howtohireme","id":33529654,"avatar_url":"https://avatars1.githubusercontent.com/u/33529654?v=4","gravatar_id":"","url":"https://api.github.com/users/howtohireme","html_url":"https://github.com/howtohireme","followers_url":"https://api.github.com/users/howtohireme/followers","following_url":"https://api.github.com/users/howtohireme/following{/other_user}","gists_url":"https://api.github.com/users/howtohireme/gists{/gist_id}","starred_url":"https://api.github.com/users/howtohireme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howtohireme/subscriptions","organizations_url":"https://api.github.com/users/howtohireme/orgs","repos_url":"https://api.github.com/users/howtohireme/repos","events_url":"https://api.github.com/users/howtohireme/events{/privacy}","received_events_url":"https://api.github.com/users/howtohireme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/howtohireme/give-me-poc","description":"Offer project idea, build development team and get a POC for free!","fork":false,"url":"https://api.github.com/repos/howtohireme/give-me-poc","forks_url":"https://api.github.com/repos/howtohireme/give-me-poc/forks","keys_url":"https://api.github.com/repos/howtohireme/give-me-poc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/howtohireme/give-me-poc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/howtohireme/give-me-poc/teams","hooks_url":"https://api.github.com/repos/howtohireme/give-me-poc/hooks","issue_events_url":"https://api.github.com/repos/howtohireme/give-me-poc/issues/events{/number}","events_url":"https://api.github.com/repos/howtohireme/give-me-poc/events","assignees_url":"https://api.github.com/repos/howtohireme/give-me-poc/assignees{/user}","branches_url":"https://api.github.com/repos/howtohireme/give-me-poc/branches{/branch}","tags_url":"https://api.github.com/repos/howtohireme/give-me-poc/tags","blobs_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/refs{/sha}","trees_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/howtohireme/give-me-poc/statuses/{sha}","languages_url":"https://api.github.com/repos/howtohireme/give-me-poc/languages","stargazers_url":"https://api.github.com/repos/howtohireme/give-me-poc/stargazers","contributors_url":"https://api.github.com/repos/howtohireme/give-me-poc/contributors","subscribers_url":"https://api.github.com/repos/howtohireme/give-me-poc/subscribers","subscription_url":"https://api.github.com/repos/howtohireme/give-me-poc/subscription","commits_url":"https://api.github.com/repos/howtohireme/give-me-poc/commits{/sha}","git_commits_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/commits{/sha}","comments_url":"https://api.github.com/repos/howtohireme/give-me-poc/comments{/number}","issue_comment_url":"https://api.github.com/repos/howtohireme/give-me-poc/issues/comments{/number}","contents_url":"https://api.github.com/repos/howtohireme/give-me-poc/contents/{+path}","compare_url":"https://api.github.com/repos/howtohireme/give-me-poc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/howtohireme/give-me-poc/merges","archive_url":"https://api.github.com/repos/howtohireme/give-me-poc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/howtohireme/give-me-poc/downloads","issues_url":"https://api.github.com/repos/howtohireme/give-me-poc/issues{/number}","pulls_url":"https://api.github.com/repos/howtohireme/give-me-poc/pulls{/number}","milestones_url":"https://api.github.com/repos/howtohireme/give-me-poc/milestones{/number}","notifications_url":"https://api.github.com/repos/howtohireme/give-me-poc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/howtohireme/give-me-poc/labels{/name}","releases_url":"https://api.github.com/repos/howtohireme/give-me-poc/releases{/id}","deployments_url":"https://api.github.com/repos/howtohireme/give-me-poc/deployments","created_at":"2018-01-12T10:54:31Z","updated_at":"2018-04-08T20:46:00Z","pushed_at":"2018-04-10T14:51:57Z","git_url":"git://github.com/howtohireme/give-me-poc.git","ssh_url":"git@github.com:howtohireme/give-me-poc.git","clone_url":"https://github.com/howtohireme/give-me-poc.git","svn_url":"https://github.com/howtohireme/give-me-poc","homepage":"","size":87,"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":18,"license":null,"forks":0,"open_issues":18,"watchers":0,"default_branch":"master"}},"base":{"label":"howtohireme:master","ref":"master","sha":"5dfbee39d1271b39cb3208330b1562f4bb917ed7","user":{"login":"howtohireme","id":33529654,"avatar_url":"https://avatars1.githubusercontent.com/u/33529654?v=4","gravatar_id":"","url":"https://api.github.com/users/howtohireme","html_url":"https://github.com/howtohireme","followers_url":"https://api.github.com/users/howtohireme/followers","following_url":"https://api.github.com/users/howtohireme/following{/other_user}","gists_url":"https://api.github.com/users/howtohireme/gists{/gist_id}","starred_url":"https://api.github.com/users/howtohireme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howtohireme/subscriptions","organizations_url":"https://api.github.com/users/howtohireme/orgs","repos_url":"https://api.github.com/users/howtohireme/repos","events_url":"https://api.github.com/users/howtohireme/events{/privacy}","received_events_url":"https://api.github.com/users/howtohireme/received_events","type":"Organization","site_admin":false},"repo":{"id":117230368,"name":"give-me-poc","full_name":"howtohireme/give-me-poc","owner":{"login":"howtohireme","id":33529654,"avatar_url":"https://avatars1.githubusercontent.com/u/33529654?v=4","gravatar_id":"","url":"https://api.github.com/users/howtohireme","html_url":"https://github.com/howtohireme","followers_url":"https://api.github.com/users/howtohireme/followers","following_url":"https://api.github.com/users/howtohireme/following{/other_user}","gists_url":"https://api.github.com/users/howtohireme/gists{/gist_id}","starred_url":"https://api.github.com/users/howtohireme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howtohireme/subscriptions","organizations_url":"https://api.github.com/users/howtohireme/orgs","repos_url":"https://api.github.com/users/howtohireme/repos","events_url":"https://api.github.com/users/howtohireme/events{/privacy}","received_events_url":"https://api.github.com/users/howtohireme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/howtohireme/give-me-poc","description":"Offer project idea, build development team and get a POC for free!","fork":false,"url":"https://api.github.com/repos/howtohireme/give-me-poc","forks_url":"https://api.github.com/repos/howtohireme/give-me-poc/forks","keys_url":"https://api.github.com/repos/howtohireme/give-me-poc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/howtohireme/give-me-poc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/howtohireme/give-me-poc/teams","hooks_url":"https://api.github.com/repos/howtohireme/give-me-poc/hooks","issue_events_url":"https://api.github.com/repos/howtohireme/give-me-poc/issues/events{/number}","events_url":"https://api.github.com/repos/howtohireme/give-me-poc/events","assignees_url":"https://api.github.com/repos/howtohireme/give-me-poc/assignees{/user}","branches_url":"https://api.github.com/repos/howtohireme/give-me-poc/branches{/branch}","tags_url":"https://api.github.com/repos/howtohireme/give-me-poc/tags","blobs_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/refs{/sha}","trees_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/howtohireme/give-me-poc/statuses/{sha}","languages_url":"https://api.github.com/repos/howtohireme/give-me-poc/languages","stargazers_url":"https://api.github.com/repos/howtohireme/give-me-poc/stargazers","contributors_url":"https://api.github.com/repos/howtohireme/give-me-poc/contributors","subscribers_url":"https://api.github.com/repos/howtohireme/give-me-poc/subscribers","subscription_url":"https://api.github.com/repos/howtohireme/give-me-poc/subscription","commits_url":"https://api.github.com/repos/howtohireme/give-me-poc/commits{/sha}","git_commits_url":"https://api.github.com/repos/howtohireme/give-me-poc/git/commits{/sha}","comments_url":"https://api.github.com/repos/howtohireme/give-me-poc/comments{/number}","issue_comment_url":"https://api.github.com/repos/howtohireme/give-me-poc/issues/comments{/number}","contents_url":"https://api.github.com/repos/howtohireme/give-me-poc/contents/{+path}","compare_url":"https://api.github.com/repos/howtohireme/give-me-poc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/howtohireme/give-me-poc/merges","archive_url":"https://api.github.com/repos/howtohireme/give-me-poc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/howtohireme/give-me-poc/downloads","issues_url":"https://api.github.com/repos/howtohireme/give-me-poc/issues{/number}","pulls_url":"https://api.github.com/repos/howtohireme/give-me-poc/pulls{/number}","milestones_url":"https://api.github.com/repos/howtohireme/give-me-poc/milestones{/number}","notifications_url":"https://api.github.com/repos/howtohireme/give-me-poc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/howtohireme/give-me-poc/labels{/name}","releases_url":"https://api.github.com/repos/howtohireme/give-me-poc/releases{/id}","deployments_url":"https://api.github.com/repos/howtohireme/give-me-poc/deployments","created_at":"2018-01-12T10:54:31Z","updated_at":"2018-04-08T20:46:00Z","pushed_at":"2018-04-10T14:51:57Z","git_url":"git://github.com/howtohireme/give-me-poc.git","ssh_url":"git@github.com:howtohireme/give-me-poc.git","clone_url":"https://github.com/howtohireme/give-me-poc.git","svn_url":"https://github.com/howtohireme/give-me-poc","homepage":"","size":87,"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":18,"license":null,"forks":0,"open_issues":18,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/33"},"html":{"href":"https://github.com/howtohireme/give-me-poc/pull/33"},"issue":{"href":"https://api.github.com/repos/howtohireme/give-me-poc/issues/33"},"comments":{"href":"https://api.github.com/repos/howtohireme/give-me-poc/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/howtohireme/give-me-poc/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/howtohireme/give-me-poc/statuses/74d6b77938ff3aced0374d603878f7576264f719"}},"author_association":"OWNER"}}
{"actor":{"display_login":"houndci-bot"}}