-
Notifications
You must be signed in to change notification settings - Fork 8
Make confirmation email for Welsh bi-lingual #2083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d76503f
Update spec for form_submission_confirmation_mailer to use explicit l…
chao-xian e6e92e2
Update form_submission_confirmation_mailer.rb to receive both en and …
chao-xian 055bed4
Update spec for confirmation email job to send both English and Welsh
chao-xian 508f1cc
Update send_confirmation_email_job.rb to explicitly send English and …
chao-xian 7d37989
Update Welsh Confirmation Notify email template
chao-xian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,22 +55,41 @@ | |
|
|
||
| expect(FormSubmissionConfirmationMailer).to have_received(:send_confirmation_email).with( | ||
| what_happens_next_markdown: "Please wait for a response", | ||
| what_happens_next_markdown_cy: nil, | ||
| support_contact_details: have_attributes( | ||
| phone: "0203 222 2222", | ||
| call_charges_url: "https://www.gov.uk/call-charges", | ||
| email: "[email protected]", | ||
| url: "https://example.gov.uk/help", | ||
| url_text: "Get help", | ||
| ), | ||
| support_contact_details_cy: nil, | ||
| notify_response_id: "confirmation-ref", | ||
| confirmation_email_address: "[email protected]", | ||
| mailer_options: an_instance_of(SendConfirmationEmailJob::MailerOptions), | ||
| submission_locale: "en", | ||
| ) | ||
| end | ||
|
|
||
| context "when locale is Welsh" do | ||
| it "uses the Welsh template" do | ||
| context "when submission locale is Welsh" do | ||
| let(:welsh_form_document) do | ||
| build(:v2_form_document, | ||
| what_happens_next_markdown: "Arhoswch am ymateb", | ||
| support_phone: "0291 111 1111", | ||
| support_email: "[email protected]") | ||
| end | ||
|
|
||
| before do | ||
| submission.update!(submission_locale: "cy") | ||
| allow(Api::V2::FormDocumentRepository).to receive(:find_with_mode).and_call_original | ||
| allow(Api::V2::FormDocumentRepository).to receive(:find_with_mode).with( | ||
| form_id: anything, | ||
| mode: anything, | ||
| language: :cy, | ||
| ).and_return(welsh_form_document) | ||
| end | ||
|
|
||
| it "uses the bilingual template" do | ||
| described_class.perform_now( | ||
| submission:, | ||
| notify_response_id:, | ||
|
|
@@ -80,6 +99,37 @@ | |
| mail = ActionMailer::Base.deliveries.last | ||
| expect(mail.govuk_notify_template).to eq("7891011") | ||
| end | ||
|
|
||
| it "passes the Welsh what happens next to the mailer" do | ||
| allow(FormSubmissionConfirmationMailer).to receive(:send_confirmation_email).and_call_original | ||
|
|
||
| described_class.perform_now( | ||
| submission:, | ||
| notify_response_id:, | ||
| confirmation_email_address:, | ||
| ) | ||
|
|
||
| expect(FormSubmissionConfirmationMailer).to have_received(:send_confirmation_email).with( | ||
| hash_including(what_happens_next_markdown_cy: "Arhoswch am ymateb"), | ||
| ) | ||
| end | ||
|
|
||
| it "passes the Welsh support details" do | ||
| allow(FormSubmissionConfirmationMailer).to receive(:send_confirmation_email).and_call_original | ||
|
|
||
| described_class.perform_now( | ||
| submission:, | ||
| notify_response_id:, | ||
| confirmation_email_address:, | ||
| ) | ||
|
|
||
| expect(FormSubmissionConfirmationMailer).to have_received(:send_confirmation_email).with( | ||
| hash_including(support_contact_details_cy: have_attributes( | ||
| phone: "0291 111 1111", | ||
| email: "[email protected]", | ||
| )), | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| context "when there is an error during processing" do | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.