insert_inline_images_spec.rb 667 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe HtmlSanitizer::Scrubber::InsertInlineImages, current_user_id: 1 do
  4. let(:scrubber) { described_class.new(sample.attachments) }
  5. let(:sample) { create(:ticket_shared_draft_start, :with_inline_image) }
  6. describe '#scrub' do
  7. subject(:actual) { fragment.scrub!(scrubber).to_html }
  8. let(:fragment) { Loofah.fragment(sample.body) }
  9. it 'converts images from cid to base64 sources' do
  10. original = attributes_for(:ticket_shared_draft_start, :with_inline_image)
  11. expect(actual).to eq original.dig(:content, :body)
  12. end
  13. end
  14. end