Fix base64-encoded file uploads not being possible (#12748)
Fix #3804, Fix #5776
This commit is contained in:
parent
500276c99b
commit
49b2f7c0a2
14 changed files with 80 additions and 62 deletions
23
spec/support/examples/models/concerns/account_header.rb
Normal file
23
spec/support/examples/models/concerns/account_header.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
shared_examples 'AccountHeader' do |fabricator|
|
||||
describe 'base64-encoded files' do
|
||||
let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
|
||||
let(:account) { Fabricate(fabricator, header: base64_attachment) }
|
||||
|
||||
it 'saves header' do
|
||||
expect(account.persisted?).to be true
|
||||
expect(account.header).to_not be_nil
|
||||
end
|
||||
|
||||
it 'gives the header a file name' do
|
||||
expect(account.header_file_name).to_not be_blank
|
||||
end
|
||||
|
||||
it 'saves a new header under a different file name' do
|
||||
previous_file_name = account.header_file_name
|
||||
account.update(header: base64_attachment)
|
||||
expect(account.header_file_name).to_not eq previous_file_name
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue