refactor: update webhook job parameters to include account webhook and delivery ID
This commit is contained in:
parent
8fcef79847
commit
89cd41c4cf
@ -22,7 +22,8 @@ describe WebhookListener do
|
||||
it 'triggers the webhook event' do
|
||||
webhook = create(:webhook, account: account, inbox: inbox)
|
||||
expect(WebhookJob).to receive(:perform_later)
|
||||
.with(webhook.url, message.webhook_data.merge(event: 'message_created')).once
|
||||
.with(webhook.url, message.webhook_data.merge(event: 'message_created'), :account_webhook,
|
||||
secret: webhook.secret, delivery_id: instance_of(String)).once
|
||||
|
||||
listener.message_created(message_created_event)
|
||||
end
|
||||
@ -124,7 +125,10 @@ describe WebhookListener do
|
||||
context 'when webhook is configured and message is incoming' do
|
||||
it 'triggers the webhook event' do
|
||||
webhook = create(:webhook, inbox: inbox, account: account, subscriptions: ['message_incoming'])
|
||||
expect(WebhookJob).to receive(:perform_later).with(webhook.url, incoming_message.webhook_data.merge(event: 'message_incoming')).once
|
||||
expect(WebhookJob).to receive(:perform_later).with(
|
||||
webhook.url, incoming_message.webhook_data.merge(event: 'message_incoming'), :account_webhook,
|
||||
secret: webhook.secret, delivery_id: instance_of(String)
|
||||
).once
|
||||
listener.message_incoming(incoming_message_event)
|
||||
end
|
||||
end
|
||||
@ -164,7 +168,10 @@ describe WebhookListener do
|
||||
context 'when webhook is configured and message is outgoing' do
|
||||
it 'triggers the webhook event' do
|
||||
webhook = create(:webhook, inbox: inbox, account: account, subscriptions: ['message_outgoing'])
|
||||
expect(WebhookJob).to receive(:perform_later).with(webhook.url, message.webhook_data.merge(event: 'message_outgoing')).once
|
||||
expect(WebhookJob).to receive(:perform_later).with(
|
||||
webhook.url, message.webhook_data.merge(event: 'message_outgoing'), :account_webhook,
|
||||
secret: webhook.secret, delivery_id: instance_of(String)
|
||||
).once
|
||||
listener.message_outgoing(message_created_event)
|
||||
end
|
||||
end
|
||||
@ -518,7 +525,10 @@ describe WebhookListener do
|
||||
provider_event_data: provider_event_data
|
||||
}
|
||||
|
||||
expect(WebhookJob).to receive(:perform_later).with(webhook.url, payload).once
|
||||
expect(WebhookJob).to receive(:perform_later).with(
|
||||
webhook.url, payload, :account_webhook,
|
||||
secret: webhook.secret, delivery_id: instance_of(String)
|
||||
).once
|
||||
listener.provider_event_received(provider_event)
|
||||
end
|
||||
end
|
||||
@ -543,7 +553,10 @@ describe WebhookListener do
|
||||
provider_event_data: provider_event_data
|
||||
}
|
||||
|
||||
expect(WebhookJob).to receive(:perform_later).with(webhook.url, payload).once
|
||||
expect(WebhookJob).to receive(:perform_later).with(
|
||||
webhook.url, payload, :account_webhook,
|
||||
secret: webhook.secret, delivery_id: instance_of(String)
|
||||
).once
|
||||
listener.provider_event_received(provider_event)
|
||||
end
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ RSpec.describe Portal do
|
||||
end
|
||||
|
||||
it 'does not allow drafting the default locale' do
|
||||
portal.update!(config: { allowed_locales: %w[en es], draft_locales: ['en'], default_locale: 'en' })
|
||||
portal.update(config: { allowed_locales: %w[en es], draft_locales: ['en'], default_locale: 'en' }) # rubocop:disable Rails/SaveBang
|
||||
|
||||
expect(portal).not_to be_valid
|
||||
expect(portal.errors.full_messages).to include('Config default locale cannot be drafted.')
|
||||
|
||||
@ -8,11 +8,12 @@ parameters:
|
||||
- name: typing_status
|
||||
in: query
|
||||
required: true
|
||||
type: string
|
||||
enum:
|
||||
- 'on'
|
||||
- 'recording'
|
||||
- 'off'
|
||||
schema:
|
||||
type: string
|
||||
enum:
|
||||
- 'on'
|
||||
- 'recording'
|
||||
- 'off'
|
||||
description: Typing status.
|
||||
requestBody:
|
||||
required: true
|
||||
|
||||
@ -1208,12 +1208,14 @@
|
||||
"name": "typing_status",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"on",
|
||||
"recording",
|
||||
"off"
|
||||
],
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"on",
|
||||
"recording",
|
||||
"off"
|
||||
]
|
||||
},
|
||||
"description": "Typing status."
|
||||
}
|
||||
],
|
||||
|
||||
@ -378,12 +378,14 @@
|
||||
"name": "typing_status",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"on",
|
||||
"recording",
|
||||
"off"
|
||||
],
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"on",
|
||||
"recording",
|
||||
"off"
|
||||
]
|
||||
},
|
||||
"description": "Typing status."
|
||||
}
|
||||
],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user