Chatwoot/spec/lib/webhooks/trigger_spec.rb

23 lines
515 B
Ruby
Raw Normal View History

2020-02-14 17:49:17 +00:00
require 'rails_helper'
describe Webhooks::Trigger do
subject(:trigger) { described_class }
describe '#execute' do
it 'triggers webhook' do
payload = { hello: :hello }
2020-07-21 06:45:24 +00:00
url = 'https://test.com'
2020-02-14 17:49:17 +00:00
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)
2020-02-14 17:49:17 +00:00
end
end
end