chore: Add timeouts to requests (#2024)
This commit is contained in:
@@ -5,11 +5,18 @@ describe Webhooks::Trigger do
|
||||
|
||||
describe '#execute' do
|
||||
it 'triggers webhook' do
|
||||
params = { hello: :hello }
|
||||
payload = { hello: :hello }
|
||||
url = 'https://test.com'
|
||||
|
||||
expect(RestClient).to receive(:post).with(url, params.to_json, { accept: :json, content_type: :json }).once
|
||||
trigger.execute(url, params)
|
||||
expect(RestClient::Request).to receive(:execute)
|
||||
.with(
|
||||
method: :post,
|
||||
url: url,
|
||||
payload: payload.to_json,
|
||||
headers: { content_type: :json, accept: :json },
|
||||
timeout: 5
|
||||
).once
|
||||
trigger.execute(url, payload)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,10 +52,11 @@ RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :maile
|
||||
end
|
||||
|
||||
describe 'assigned_conversation_new_message' do
|
||||
let(:mail) { described_class.assigned_conversation_new_message(conversation, agent).deliver_now }
|
||||
let(:message) { create(:message, conversation: conversation, account: account) }
|
||||
let(:mail) { described_class.assigned_conversation_new_message(message, agent).deliver_now }
|
||||
|
||||
it 'renders the subject' do
|
||||
expect(mail.subject).to eq("#{agent.available_name}, New message in your assigned conversation [ID - #{conversation.display_id}].")
|
||||
expect(mail.subject).to eq("#{agent.available_name}, New message in your assigned conversation [ID - #{message.conversation.display_id}].")
|
||||
end
|
||||
|
||||
it 'renders the receiver email' do
|
||||
|
||||
Reference in New Issue
Block a user