feat: Send MMS through Twilio Inbox (#2959)
Send MMS message to customer for Twilio integration inbox. Fixes #2311
This commit is contained in:
@@ -77,5 +77,20 @@ describe Twilio::SendOnTwilioService do
|
||||
|
||||
::Twilio::SendOnTwilioService.new(message: message).perform
|
||||
end
|
||||
|
||||
it 'if outgoing message has attachment and is for sms' do
|
||||
# check for message attachment url
|
||||
allow(messages_double).to receive(:create).with(hash_including(media_url: [anything])).and_return(message_record_double)
|
||||
allow(message_record_double).to receive(:sid).and_return('1234')
|
||||
|
||||
message = build(
|
||||
:message, message_type: 'outgoing', inbox: twilio_inbox, account: account, conversation: conversation
|
||||
)
|
||||
attachment = message.attachments.new(account_id: message.account_id, file_type: :image)
|
||||
attachment.file.attach(io: File.open(Rails.root.join('spec/assets/avatar.png')), filename: 'avatar.png', content_type: 'image/png')
|
||||
message.save!
|
||||
|
||||
::Twilio::SendOnTwilioService.new(message: message).perform
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user