Files
openfoodnetwork/spec/models/report_blob_spec.rb
Maikel Linke 19ef047193 Create observable reports blob early
This will allow us to check for completion of the report later in case
websockets fail.
2024-08-16 14:37:57 +10:00

23 lines
606 B
Ruby

# frozen_string_literal: false
require 'spec_helper'
RSpec.describe ReportBlob, type: :model do
it "preserves UTF-8 content" do
content = "This works. ✓"
expect do
blob = ReportBlob.create_locally!("customers.html", content)
content = blob.result
end.not_to change { content.encoding }.from(Encoding::UTF_8)
end
it "can be created first and filled later" do
blob = ReportBlob.create_for_upload_later!("customers.html")
expect { blob.store("Hello") }
.to change { blob.checksum }.from("0")
.and change { blob.result }.from(nil).to("Hello")
end
end