fix: revert Twilio message creation using create! instead of create (#118)
This commit is contained in:
parent
96d1003548
commit
9cd3edb497
@ -52,7 +52,7 @@ class Channel::TwilioSms < ApplicationRecord
|
|||||||
params = send_message_from.merge(to: to, body: body)
|
params = send_message_from.merge(to: to, body: body)
|
||||||
params[:media_url] = media_url if media_url.present?
|
params[:media_url] = media_url if media_url.present?
|
||||||
params[:status_callback] = twilio_delivery_status_index_url
|
params[:status_callback] = twilio_delivery_status_index_url
|
||||||
client.messages.create!(**params)
|
client.messages.create(**params) # rubocop:disable Rails/SaveBang
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@ -43,7 +43,7 @@ RSpec.describe Channel::TwilioSms do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'sends via twilio client' do
|
it 'sends via twilio client' do
|
||||||
expect(twilio_messages).to receive(:create!).with(
|
expect(twilio_messages).to receive(:create).with(
|
||||||
messaging_service_sid: channel.messaging_service_sid,
|
messaging_service_sid: channel.messaging_service_sid,
|
||||||
to: '+15555550111',
|
to: '+15555550111',
|
||||||
body: 'hello world',
|
body: 'hello world',
|
||||||
@ -57,7 +57,7 @@ RSpec.describe Channel::TwilioSms do
|
|||||||
let(:channel) { create(:channel_twilio_sms, :with_phone_number) }
|
let(:channel) { create(:channel_twilio_sms, :with_phone_number) }
|
||||||
|
|
||||||
it 'sends via twilio client' do
|
it 'sends via twilio client' do
|
||||||
expect(twilio_messages).to receive(:create!).with(
|
expect(twilio_messages).to receive(:create).with(
|
||||||
from: channel.phone_number,
|
from: channel.phone_number,
|
||||||
to: '+15555550111',
|
to: '+15555550111',
|
||||||
body: 'hello world',
|
body: 'hello world',
|
||||||
@ -70,7 +70,7 @@ RSpec.describe Channel::TwilioSms do
|
|||||||
|
|
||||||
context 'with media urls' do
|
context 'with media urls' do
|
||||||
it 'supplies a media url' do
|
it 'supplies a media url' do
|
||||||
expect(twilio_messages).to receive(:create!).with(
|
expect(twilio_messages).to receive(:create).with(
|
||||||
messaging_service_sid: channel.messaging_service_sid,
|
messaging_service_sid: channel.messaging_service_sid,
|
||||||
to: '+15555550111',
|
to: '+15555550111',
|
||||||
body: 'hello world',
|
body: 'hello world',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user