@@ -309,6 +309,18 @@ RSpec.describe 'Inboxes API', type: :request do
|
||||
expect(response.body).to include('callback_webhook_url')
|
||||
end
|
||||
|
||||
it 'creates a sms inbox when administrator' do
|
||||
post "/api/v1/accounts/#{account.id}/inboxes",
|
||||
headers: admin.create_new_auth_token,
|
||||
params: { name: 'Sms Inbox',
|
||||
channel: { type: 'sms', phone_number: '+123456789', provider_config: { test: 'test' } } },
|
||||
as: :json
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include('Sms Inbox')
|
||||
expect(response.body).to include('+123456789')
|
||||
end
|
||||
|
||||
it 'creates the webwidget inbox that allow messages after conversation is resolved' do
|
||||
post "/api/v1/accounts/#{account.id}/inboxes",
|
||||
headers: admin.create_new_auth_token,
|
||||
|
||||
12
spec/controllers/webhooks/sms_controller_spec.rb
Normal file
12
spec/controllers/webhooks/sms_controller_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Webhooks::SmsController', type: :request do
|
||||
describe 'POST /webhooks/sms/{:phone_number}' do
|
||||
it 'call the sms events job with the params' do
|
||||
allow(Webhooks::SmsEventsJob).to receive(:perform_later)
|
||||
expect(Webhooks::SmsEventsJob).to receive(:perform_later)
|
||||
post '/webhooks/sms/123221321', params: { content: 'hello' }
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user