2022-04-20 17:12:13 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Attachment, type: :model do
|
|
|
|
describe 'download_url' do
|
|
|
|
it 'returns valid download url' do
|
|
|
|
message = create(:message)
|
|
|
|
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')
|
2022-07-15 02:51:59 +00:00
|
|
|
expect(attachment.download_url).not_to be_nil
|
2022-04-20 17:12:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|