You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
778 B

  1. # frozen_string_literal: true
  2. shared_examples 'AccountHeader' do |fabricator|
  3. describe 'base64-encoded files' do
  4. let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
  5. let(:account) { Fabricate(fabricator, header: base64_attachment) }
  6. it 'saves header' do
  7. expect(account.persisted?).to be true
  8. expect(account.header).to_not be_nil
  9. end
  10. it 'gives the header a file name' do
  11. expect(account.header_file_name).to_not be_blank
  12. end
  13. it 'saves a new header under a different file name' do
  14. previous_file_name = account.header_file_name
  15. account.update(header: base64_attachment)
  16. expect(account.header_file_name).to_not eq previous_file_name
  17. end
  18. end
  19. end