Files
openfoodnetwork/spec/mailers/report_mailer_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

32 lines
795 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ReportMailer do
describe "#report_ready" do
subject(:email) {
ReportMailer.with(
to: "current_user@example.net",
blob:,
).report_ready
}
let(:blob) { ReportBlob.create_locally!("customers.csv", "report content") }
it "notifies about a report" do
expect(email.subject).to eq "Report ready"
expect(email.body).to have_content "Report ready for download"
end
it "notifies the user" do
expect(email.to).to eq ["current_user@example.net"]
end
it "contains a download link" do
expect(email.body).to have_link(
"customers.csv",
href: %r"^http://test\.host/rails/active_storage/disk/.*/customers\.csv$"
)
end
end
end