This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2020-01-03 16:54:07 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
shared_examples 'AccountHeader' do |fabricator|
|
2023-06-10 09:27:35 -07:00
|
|
|
describe 'base64-encoded files', paperclip_processing: true do
|
2020-01-03 16:54:07 -08:00
|
|
|
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
|