Browse Source

Update email link

pull/1615/head
Kat 3 years ago
parent
commit
4292b9167d
  1. 2
      app/mailers/bulk_upload_mailer.rb
  2. 23
      spec/mailers/bulk_upload_mailer_spec.rb

2
app/mailers/bulk_upload_mailer.rb

@ -29,7 +29,7 @@ class BulkUploadMailer < NotifyMailer
def send_check_soft_validations_mail(bulk_upload:)
title = "Check your file data"
description = "Some of your #{bulk_upload.year_combo} #{bulk_upload.log_type} data might not be right. Click the link below to review the potential errors, and check your file to see if the data is correct."
cta_link = bulk_upload.sales? ? bulk_upload_sales_data_check_url(bulk_upload) : bulk_upload_lettings_data_check_url(bulk_upload)
cta_link = bulk_upload.sales? ? bulk_upload_sales_data_check_url(bulk_upload, page: "soft-errors-valid") : bulk_upload_lettings_data_check_url(bulk_upload, page: "soft-errors-valid")
send_email(
bulk_upload.user.email,

23
spec/mailers/bulk_upload_mailer_spec.rb

@ -97,4 +97,27 @@ RSpec.describe BulkUploadMailer do
end
end
end
describe "#send_check_soft_validations_mail" do
before do
create(:bulk_upload_error, bulk_upload:, col: "A", field: "field_1", category: "soft_validation")
create(:bulk_upload_error, bulk_upload:, col: "E", field: "field_4", category: "soft_validation")
end
it "sends correctly formed email" do
expect(notify_client).to receive(:send_email).with(
email_address: bulk_upload.user.email,
template_id: described_class::CHECK_SOFT_VALIDATIONS_TEMPLATE_ID,
personalisation: {
title: "Check your file data",
filename: bulk_upload.filename,
upload_timestamp: bulk_upload.created_at.to_fs(:govuk_date_and_time),
description: "Some of your 2022/23 lettings data might not be right. Click the link below to review the potential errors, and check your file to see if the data is correct.",
cta_link: bulk_upload_lettings_data_check_url(bulk_upload, page: "soft-errors-valid"),
},
)
mailer.send_check_soft_validations_mail(bulk_upload:)
end
end
end

Loading…
Cancel
Save