mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
feat: notify on slack disconnect (#1323)
This commit is contained in:
@@ -27,5 +27,24 @@ describe Integrations::Slack::SendOnSlackService do
|
||||
|
||||
builder.perform
|
||||
end
|
||||
|
||||
it 'disables hook on Slack AccountInactive error' do
|
||||
builder = described_class.new(message: message, hook: hook)
|
||||
slack_client = double
|
||||
expect(builder).to receive(:slack_client).and_return(slack_client)
|
||||
expect(slack_client).to receive(:chat_postMessage).with(
|
||||
channel: hook.reference_id,
|
||||
text: message.content,
|
||||
username: "Contact: #{message.sender.name}",
|
||||
thread_ts: conversation.identifier,
|
||||
icon_url: anything
|
||||
).and_raise(Slack::Web::Api::Errors::AccountInactive.new('Account disconnected'))
|
||||
|
||||
allow(hook).to receive(:authorization_error!)
|
||||
|
||||
builder.perform
|
||||
expect(hook).to be_disabled
|
||||
expect(hook).to have_received(:authorization_error!)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user