chore: Add timeouts to requests (#2024)

This commit is contained in:
Sojan Jose 2021-03-31 16:39:57 +05:30 committed by GitHub
parent f5a961b27c
commit c8b81b066b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 10 deletions

View file

@ -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