Files
openfoodnetwork/spec/models/report_blob_spec.rb
Maikel Linke 630169f8bb Preserve encoding of stored reports
Active Storage reads stored strings as ASCII and that can clash with
Rails' default UTF-8 encoding when special characters are present.
2023-04-28 16:38:06 +10:00

16 lines
367 B
Ruby

# frozen_string_literal: false
require 'spec_helper'
describe ReportBlob, type: :model do
it "preserves UTF-8 content" do
blob = ReportBlob.create_for_upload_later!("customers.html")
content = "This works. ✓"
expect do
blob.store(content)
content = blob.result
end.to_not change { content.encoding }.from(Encoding::UTF_8)
end
end