diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index f0040275f7..44b6f61ac5 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -49,11 +49,17 @@ def application_not_submitted end def application_received - view_mail( - GOVUK_NOTIFY_TEMPLATE_ID, - to: teacher.email, - subject: I18n.t("mailer.teacher.application_received.subject"), - ) + subject = + if @application_form.teaching_authority_provides_written_statement + I18n.t( + "mailer.teacher.application_received.subject.awaiting_document", + certificate: region_certificate_name(region), + ) + else + I18n.t("mailer.teacher.application_received.subject.without_document") + end + + view_mail(GOVUK_NOTIFY_TEMPLATE_ID, to: teacher.email, subject:) end def consent_reminder @@ -93,6 +99,8 @@ def further_information_received end def further_information_requested + @further_information_request = params[:further_information_request] + view_mail( GOVUK_NOTIFY_TEMPLATE_ID, to: teacher.email, diff --git a/app/services/request_further_information.rb b/app/services/request_further_information.rb index 5bedd96074..a9d0fa0d62 100644 --- a/app/services/request_further_information.rb +++ b/app/services/request_further_information.rb @@ -11,8 +11,7 @@ def initialize(assessment:, user:) def call raise AlreadyExists if assessment.further_information_requests.exists? - create_and_request - send_email + send_email(create_and_request) end class AlreadyExists < StandardError @@ -47,11 +46,12 @@ def create_and_request end end - def send_email + def send_email(further_information_request) DeliverEmail.call( application_form:, mailer: TeacherMailer, action: :further_information_requested, + further_information_request:, ) end end diff --git a/app/views/shared/teacher_mailer/_any_questions_contact.text.erb b/app/views/shared/teacher_mailer/_any_questions_contact.text.erb index ee5e1baa1f..aef4a3fc54 100644 --- a/app/views/shared/teacher_mailer/_any_questions_contact.text.erb +++ b/app/views/shared/teacher_mailer/_any_questions_contact.text.erb @@ -1 +1 @@ -If you have any questions, contact: [<%= t("service.email.enquiries") %>](mailto:<%= t("service.email.enquiries") %>) +Contact [<%= t("service.email.enquiries") %>](mailto:<%= t("service.email.enquiries") %>) with queries. We aim to respond within 5 working days. Please note we will not be able to give you progress updates on your application. diff --git a/app/views/teacher_mailer/application_not_submitted.text.erb b/app/views/teacher_mailer/application_not_submitted.text.erb index ddc0afcacd..57e3df3eff 100644 --- a/app/views/teacher_mailer/application_not_submitted.text.erb +++ b/app/views/teacher_mailer/application_not_submitted.text.erb @@ -2,27 +2,24 @@ Dear <%= application_form_full_name(@application_form) %>, <% case @number_of_reminders_sent %> <% when 0 %> -We’ve noticed that you have a draft application for qualified teacher status (QTS) that has not been submitted. +You have a draft application for qualified teacher status (QTS) in England that has not been submitted. -We need to let you know that if you do not complete and submit your application by <%= @application_form.expires_at.to_date.to_fs %> we’ll delete the application. +Applications need to be submitted within 6 months of being started. If you do not complete and submit your application by <%= @application_form.expires_at.to_date.to_fs %> it will be deleted. <% when 1 %> -We contacted you a week ago about your draft application for qualified teacher status (QTS). +We recently contacted you about your draft application for qualified teacher status (QTS) in England that has not been submitted. -If you do not complete and submit your application by <%= @application_form.expires_at.to_date.to_fs %> we’ll delete the application. +Applications need to be submitted within 6 months of being started. If you do not complete and submit your application by <%= @application_form.expires_at.to_date.to_fs %> it will be deleted. <% end %> # What happens if your application is deleted? -We’re required to delete any QTS applications that are not submitted within 6 months of being started. +If you do not submit your application before the above date it will be deleted permanently. If you still want to apply for QTS after that date you’ll need to start a new application. -Applications are deleted permanently, so if you still wanted to apply for QTS after that date, you’d need to begin a brand new application. +# What you can do +If you still want to apply for QTS you must do so by <%= @application_form.expires_at.to_date.to_fs %>. You can sign in using the link below to complete and submit your application. -# Your next steps +[Sign in to your application](<%= new_teacher_session_url %>) -If you still want to apply for QTS you must do so before <%= @application_form.expires_at.to_date.to_fs %>. You can sign in to complete and submit your application using the link below: - -<%= new_teacher_session_url %> - -If you no longer want to apply, you do not need to take any action. +If you no longer want to apply, you do not need to take any action. Your draft application will be deleted. <%= render "shared/teacher_mailer/footer" %> diff --git a/app/views/teacher_mailer/application_received.text.erb b/app/views/teacher_mailer/application_received.text.erb index b3aa72be07..34194cc1f3 100644 --- a/app/views/teacher_mailer/application_received.text.erb +++ b/app/views/teacher_mailer/application_received.text.erb @@ -1,23 +1,25 @@ Dear <%= application_form_full_name(@application_form) %>, -# We’ve received your application for qualified teacher status (QTS) +# We’ve received your application for qualified teacher status (QTS) in England <%= render "shared/teacher_mailer/reference_number" %> +<% if @application_form.teaching_authority_provides_written_statement %> +We are waiting to receive the written evidence you’ve requested from your teaching authority. +<% end %> + # What happens next <% if @application_form.teaching_authority_provides_written_statement %> -When we’ve received the written evidence you’ve requested from your teaching authority, we’ll add your application to the queue to be assigned to a QTS assessor — this can take several weeks. +Once the written evidence is received and checked, your application will be entered into a queue and assigned a QTS assessor. This can take several weeks. <% else %> -Your application will be entered into a queue and assigned a QTS assessor, which can take several weeks. +Your application will be entered into a queue and assigned a QTS assessor. This can take several weeks. <% end %> -Once assigned, an assessor will review your application. If we require more information, we'll email you for it. +Once assigned, an assessor will review your application. If we need more information, we'll email you. -We will contact you with a final QTS application decision once all checks and verifications have been completed. +We will contact you with a decision about your QTS application when the assessment and all verifications have been completed. <%= render "shared/teacher_mailer/any_questions_contact" %> -<%= render "shared/teacher_mailer/help_us_to_improve_this_service" %> - <%= render "shared/teacher_mailer/footer" %> diff --git a/app/views/teacher_mailer/further_information_received.text.erb b/app/views/teacher_mailer/further_information_received.text.erb index 09ca9d11a8..b90e2f7bfd 100644 --- a/app/views/teacher_mailer/further_information_received.text.erb +++ b/app/views/teacher_mailer/further_information_received.text.erb @@ -1,14 +1,10 @@ Dear <%= application_form_full_name(@application_form) %>, -# The assessor has now resumed their review of your QTS application. - -<%= render "shared/teacher_mailer/reference_number" %> - -Thanks for sending the additional information we requested. The assessor will now continue reviewing your application. +Thank you for sending the information we recently requested from you. The assessor will now continue reviewing your application. # What happens next -We will contact you with a final QTS application decision once all checks and verifications have been completed. +We will contact you with a decision about your QTS application when the assessment and all verifications have been completed. This can take several weeks. <%= render "shared/teacher_mailer/any_questions_contact" %> diff --git a/app/views/teacher_mailer/further_information_reminder.text.erb b/app/views/teacher_mailer/further_information_reminder.text.erb index f5ed7f195e..621b39eab4 100644 --- a/app/views/teacher_mailer/further_information_reminder.text.erb +++ b/app/views/teacher_mailer/further_information_reminder.text.erb @@ -1,18 +1,16 @@ Dear <%= application_form_full_name(@application_form) %>, -# The assessor reviewing your QTS application needs more information +We recently contacted you about more information needed by the assessor reviewing your QTS application. -<%= render "shared/teacher_mailer/reference_number" %> +We haven’t received the information requested. Your application cannot proceed without this information. If you do not respond by <%= @further_information_request.expires_at.to_date.to_fs %> then your QTS application will be declined. -# What happens next +# What you need to do -You must respond to this request by <%= @further_information_request.expires_at.to_date.to_fs %> otherwise your QTS application will be declined. +Sign in using the link below to see what information is needed and add it. -Once you respond with all of the information we’ve requested, the assessor will be able to continue reviewing your application. +[Sign in to your application](<%= new_teacher_session_url %>) -You can sign in to add the requested information to your application at: - -<%= new_teacher_session_url %> +Once you respond with all the information requested, the assessor will be able to continue reviewing your application. <%= render "shared/teacher_mailer/any_questions_contact" %> diff --git a/app/views/teacher_mailer/further_information_requested.text.erb b/app/views/teacher_mailer/further_information_requested.text.erb index 8df7745743..8dc1a5d305 100644 --- a/app/views/teacher_mailer/further_information_requested.text.erb +++ b/app/views/teacher_mailer/further_information_requested.text.erb @@ -2,18 +2,14 @@ Dear <%= application_form_full_name(@application_form) %>, The assessor reviewing your QTS application needs more information. -# What happens next +The assessor needs this information by <%= @further_information_request.expires_at.to_date.to_fs %> for your application to proceed. -You must respond to this request within 30 working days of this email. +# What you need to do -Once you respond with all of the information we’ve requested, the assessor will be able to continue reviewing your application. +[Sign in to your application](<%= new_teacher_session_url %>) -You can sign in to add the requested information to your application at: - -<%= new_teacher_session_url %> +Your application is on hold until this information is received. Once you respond with all the information requested, the assessor will be able to continue reviewing your application. <%= render "shared/teacher_mailer/any_questions_contact" %> -<%= render "shared/teacher_mailer/help_us_to_improve_this_service" %> - <%= render "shared/teacher_mailer/footer" %> diff --git a/app/views/teacher_mailer/initial_checks_passed.text.erb b/app/views/teacher_mailer/initial_checks_passed.text.erb index f8bb8f7228..4cb87db8cb 100644 --- a/app/views/teacher_mailer/initial_checks_passed.text.erb +++ b/app/views/teacher_mailer/initial_checks_passed.text.erb @@ -1,25 +1,20 @@ Dear <%= application_form_full_name(@application_form) %>, -# We’ve performed our initial checks on your application +# Your application for QTS in England has passed initial checks -<%= render "shared/teacher_mailer/reference_number" %> +You now need to request your <%= region_certificate_name(@application_form.region) %> from <%= region_teaching_authority_name(@application_form.region) %>. -You should now request your <%= region_certificate_name(@application_form.region) %> from <%= region_teaching_authority_name(@application_form.region) %>. Contact them directly and instruct them to send the document to [<%= t("service.email.verification") %>](mailto:<%= t("service.email.verification") %>). +Contact them directly and ask them to send the document to [<%= t("service.email.verification") %>](mailto:<%= t("service.email.verification") %>). -Once we receive the document, we’ll begin the full assessment of your application. +# Information about your <%= region_certificate_name(@application_form.region) %> +Sign in to find out more information about your <%= region_certificate_name(@application_form.region) %> before you request it. This could include instructions and fees. -# Important information about your <%= region_certificate_name(@application_form.region) %> - -Sign in to see important information about your <%= region_certificate_name(@application_form.region) %> before you request it. - -<%= new_teacher_session_url %> +[Sign in to your application](<%= new_teacher_session_url %>) # What happens next -We will contact you with a final QTS application decision once all checks and verifications have been completed. - -<%= render "shared/teacher_mailer/help_us_to_improve_this_service" %> +Once we receive your <%= region_certificate_name(@application_form.region) %>, your application will be entered into a queue and assigned a QTS assessor. We will email you if we need any further information. -<%= render "shared/teacher_mailer/any_questions_contact" %> +Contact [<%= t("service.email.enquiries") %>](mailto:<%= t("service.email.enquiries") %>) with queries. We aim to respond within 5 working days. <%= render "shared/teacher_mailer/footer" %> diff --git a/app/views/teacher_mailer/professional_standing_received.text.erb b/app/views/teacher_mailer/professional_standing_received.text.erb index 0586bccce2..cdb5c87e3f 100644 --- a/app/views/teacher_mailer/professional_standing_received.text.erb +++ b/app/views/teacher_mailer/professional_standing_received.text.erb @@ -2,17 +2,15 @@ Dear <%= application_form_full_name(@application_form) %>, # We’ve received your <%= region_certificate_name(@application_form.region) %> -Thank you for requesting your <%= region_certificate_name(@application_form.region) %> from <%= region_teaching_authority_name_phrase(@application_form.region) %>. We have now received this document and attached it to your application. - -<%= render "shared/teacher_mailer/reference_number" %> +We have received your <%= region_certificate_name(@application_form.region) %> from <%= region_teaching_authority_name_phrase(@application_form.region) %> and attached it to your application. # What happens next -Your application will be entered into a queue and assigned a QTS assessor, which can take several weeks. +Your application will be entered into a queue and assigned a QTS assessor. This can take several weeks. -Once assigned, an assessor will review your application. If we require more information, we'll email you for it. +Once assigned, an assessor will review your application. If we need more information, we'll email you. -We will contact you with a final QTS application decision once all checks and verifications have been completed. +We will contact you with a decision about your QTS application when the assessment and all verifications have been completed. <%= render "shared/teacher_mailer/any_questions_contact" %> diff --git a/app/views/teacher_mailer/references_requested.text.erb b/app/views/teacher_mailer/references_requested.text.erb index 19072b9f03..8970b054bb 100644 --- a/app/views/teacher_mailer/references_requested.text.erb +++ b/app/views/teacher_mailer/references_requested.text.erb @@ -1,6 +1,10 @@ Dear <%= application_form_full_name(@application_form) %>, -We’ve contacted the references you provided to verify the work history information you gave as part of your QTS application. +We’ve contacted the following references you provided to verify the work history information you gave as part of your QTS application. + +<% @reference_requests.each do |reference_request| %> + <%= reference_request.work_history.contact_name %> +<% end %> They need to respond by <%= @reference_requests.first.expires_at.to_date.to_fs %>. If your references do not respond, and, as a result, we cannot verify your work history, we may not be able to award you QTS. diff --git a/app/views/teachers/magic_links/show.html.erb b/app/views/teachers/magic_links/show.html.erb index c83828dc3b..7a822a453c 100644 --- a/app/views/teachers/magic_links/show.html.erb +++ b/app/views/teachers/magic_links/show.html.erb @@ -1,9 +1,13 @@ <% content_for :page_title, "Sign in" %> -
- You’re signing in to the account you created for <%= @resource.email %>. + Thank you for confirming your email address. +
+ ++ You can now sign in to the application you created for <%= @resource.email %>.
<%= form_with url: teacher_magic_link_path do |f| %> diff --git a/app/views/teachers/mailer/magic_link.text.erb b/app/views/teachers/mailer/magic_link.text.erb index d9e9931f3e..96e93b9e8a 100644 --- a/app/views/teachers/mailer/magic_link.text.erb +++ b/app/views/teachers/mailer/magic_link.text.erb @@ -1,7 +1,13 @@ -Hello <%= @resource.email %> +Hello, <%= @resource.email %>, -You can sign in using the link below: +<% if @resource.sign_in_count == 0 %> +Thank you for your interest in applying for qualified teacher status (QTS) in England. Use the link below to confirm your email address and start your application. +<% else %> +Welcome back to apply for qualified teacher status (QTS) in England. Use the link below to confirm your email address and sign in to your application. +<% end %> -<%= teacher_magic_link_url(token: @token) %> +[Confirm your email address](<%= teacher_magic_link_url(token: @token) %>) -Note that the link will expire in <%= Devise.passwordless_login_within.inspect %>. +Please note, this link will expire in <%= Devise.passwordless_login_within.inspect %>. After that time, you will need to [return to the service](<%= create_or_new_teacher_session_url %>) and request another confirmation link. + +<%= render "shared/teacher_mailer/footer" %> diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 9d2c16a244..69d3ce0753 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -30,7 +30,7 @@ en: password_change: subject: "Password Changed" magic_link: - subject: "Confirm your email address" + subject: "Confirm your email: apply for qualified teacher status (QTS)" omniauth_callbacks: failure: 'Could not authenticate you from %{kind} because "%{reason}".' success: "Successfully authenticated from %{kind} account." diff --git a/config/locales/mailer.en.yml b/config/locales/mailer.en.yml index e2669fce81..b45872dfaf 100644 --- a/config/locales/mailer.en.yml +++ b/config/locales/mailer.en.yml @@ -16,10 +16,12 @@ en: subject: "Update: Your qualified teacher status (QTS) application" application_not_submitted: subject: - 0: Your draft QTS application will be deleted in 2 weeks - 1: Your draft QTS application will be deleted in 1 week + 0: Your draft QTS application has not been submitted + 1: Your draft QTS application is about to be deleted application_received: - subject: We’ve received your application for qualified teacher status (QTS) + subject: + without_document: Your QTS application has been received + awaiting_document: "Your QTS application: Awaiting %{certificate}" consent_reminder: subject: "Reminder: we need your written consent to progress your QTS application" consent_requested: @@ -27,15 +29,15 @@ en: consent_submitted: subject: We’ve received your consent documents further_information_received: - subject: We’ve received the additional information you sent us + subject: "Your QTS application: information received" further_information_requested: - subject: We need some more information to progress your QTS application + subject: "Your QTS application: More information needed" further_information_reminder: - subject: We still need some more information to progress your QTS application + subject: "Your QTS application: information still needed" initial_checks_passed: - subject: Your application for qualified teacher status (QTS) – initial checks passed + subject: "Your QTS application: Initial checks passed" professional_standing_received: - subject: Your qualified teacher status application – we’ve received your %{certificate} + subject: "Your QTS application: %{certificate} received" references_requested: subject: We’ve contacted your references – QTS application references_reminder: diff --git a/spec/mailers/teacher_mailer_spec.rb b/spec/mailers/teacher_mailer_spec.rb index ecd4e40ac1..3e03834618 100644 --- a/spec/mailers/teacher_mailer_spec.rb +++ b/spec/mailers/teacher_mailer_spec.rb @@ -134,9 +134,7 @@ let(:number_of_reminders_sent) { 0 } it do - is_expected.to eq( - "Your draft QTS application will be deleted in 2 weeks", - ) + is_expected.to eq("Your draft QTS application has not been submitted") end end @@ -144,9 +142,7 @@ let(:number_of_reminders_sent) { 1 } it do - is_expected.to eq( - "Your draft QTS application will be deleted in 1 week", - ) + is_expected.to eq("Your draft QTS application is about to be deleted") end end end @@ -168,14 +164,12 @@ it do is_expected.to include( - "We’ve noticed that you have a draft application for qualified " \ - "teacher status (QTS) that has not been submitted.", + "You have a draft application for qualified teacher status (QTS) in England that has not been submitted.", ) end it do is_expected.to include( - "We need to let you know that if you do not complete and submit " \ - "your application by 1 July 2020 we’ll delete the application.", + "Applications need to be submitted within 6 months of being started.", ) end end @@ -185,12 +179,13 @@ it do is_expected.to include( - "We contacted you a week ago about your draft application for qualified teacher status (QTS).", + "We recently contacted you about your draft application for qualified teacher " \ + "status (QTS) in England that has not been submitted.", ) end it do is_expected.to include( - "If you do not complete and submit your application by 1 July 2020 we’ll delete the application.", + "Applications need to be submitted within 6 months of being started.", ) end end @@ -205,10 +200,30 @@ describe "#subject" do subject(:subject) { mail.subject } - it do - is_expected.to eq( - "We’ve received your application for qualified teacher status (QTS)", - ) + context "if the teaching authority provides the written statement" do + before do + application_form.update!( + teaching_authority_provides_written_statement: true, + ) + end + + it do + is_expected.to include( + "Your QTS application: Awaiting Letter of Professional Standing", + ) + end + end + + context "if the teaching authority does not provide the written statement" do + let(:certificate) { region_certificate_name(application_form.region) } + + before do + application_form.update!( + teaching_authority_provides_written_statement: false, + ) + end + + it { is_expected.to include("Your QTS application has been received") } end end @@ -226,7 +241,7 @@ it do is_expected.to include( - "Your application will be entered into a queue and assigned a QTS assessor, which can take several weeks.", + "Your application will be entered into a queue and assigned a QTS assessor. This can take several weeks.", ) end @@ -239,8 +254,22 @@ it do is_expected.to include( - "When we’ve received the written evidence you’ve requested from your teaching authority, we’ll " \ - "add your application to the queue to be assigned to a QTS assessor — this can take several weeks.", + "Once the written evidence is received and checked, your application will be entered into " \ + "a queue and assigned a QTS assessor. This can take several weeks.", + ) + end + end + + context "if the teaching authority does not provide the written statement" do + before do + application_form.update!( + teaching_authority_provides_written_statement: false, + ) + end + + it do + is_expected.to include( + "Your application will be entered into a queue and assigned a QTS assessor. This can take several weeks.", ) end end @@ -368,11 +397,7 @@ describe "#subject" do subject(:subject) { mail.subject } - it do - is_expected.to eq( - "We’ve received the additional information you sent us", - ) - end + it { is_expected.to eq("Your QTS application: information received") } end describe "#to" do @@ -385,7 +410,6 @@ subject(:body) { mail.body } it { is_expected.to include("Dear First Last") } - it { is_expected.to include("abc") } end end @@ -398,17 +422,13 @@ end let(:further_information_request) do - create(:further_information_request, assessment:) + create(:further_information_request, :requested, assessment:) end describe "#subject" do subject(:subject) { mail.subject } - it do - is_expected.to eq( - "We need some more information to progress your QTS application", - ) - end + it { is_expected.to eq("Your QTS application: More information needed") } end describe "#to" do @@ -449,11 +469,7 @@ describe "#subject" do subject(:subject) { mail.subject } - it do - is_expected.to eq( - "We still need some more information to progress your QTS application", - ) - end + it { is_expected.to eq("Your QTS application: information still needed") } end describe "#to" do @@ -468,11 +484,10 @@ it { is_expected.to include("Dear First Last") } it do is_expected.to include( - "You must respond to this request by 12 February 2020 " \ - "otherwise your QTS application will be declined.", + "If you do not respond by 12 February 2020 " \ + "then your QTS application will be declined.", ) end - it { is_expected.to include("abc") } it { is_expected.to include("http://localhost:3000/teacher/sign_in") } end end @@ -487,8 +502,7 @@ it do is_expected.to eq( - "Your qualified teacher status application – we’ve received your " \ - "Letter of Professional Standing", + "Your QTS application: Letter of Professional Standing received", ) end end @@ -503,12 +517,10 @@ subject(:body) { mail.body } it { is_expected.to include("Dear First Last") } - it { is_expected.to include("abc") } it do is_expected.to include( - "Thank you for requesting your Letter of Professional Standing from the " \ - "teaching authority. We have now received this document and attached " \ - "it to your application.", + "We have received your Letter of Professional Standing from the teaching " \ + "authority and attached it to your application.", ) end end @@ -616,7 +628,8 @@ it { is_expected.to include("Dear First Last") } it do is_expected.to include( - "We’ve contacted the references you provided to verify the work history", + "We’ve contacted the following references you provided to verify the work " \ + "history information you gave as part of your QTS application.", ) end end diff --git a/spec/system/assessor_interface/requesting_further_information_spec.rb b/spec/system/assessor_interface/requesting_further_information_spec.rb index 21ee2134e1..ac51d1a9e0 100644 --- a/spec/system/assessor_interface/requesting_further_information_spec.rb +++ b/spec/system/assessor_interface/requesting_further_information_spec.rb @@ -60,7 +60,7 @@ def and_i_receive_a_further_information_requested_email expect(message).to_not be_nil expect(message.subject).to eq( - "We need some more information to progress your QTS application", + "Your QTS application: More information needed", ) expect(message.to).to include(application_form.teacher.email) end diff --git a/spec/system/teacher_interface/authentication_spec.rb b/spec/system/teacher_interface/authentication_spec.rb index 998bf35059..3c42b2fc75 100644 --- a/spec/system/teacher_interface/authentication_spec.rb +++ b/spec/system/teacher_interface/authentication_spec.rb @@ -156,13 +156,35 @@ def and_i_receive_a_teacher_magic_link_email message = ActionMailer::Base.deliveries.last expect(message).to_not be_nil - expect(message.subject).to eq("Confirm your email address") + expect(message.subject).to eq( + "Confirm your email: apply for qualified teacher status (QTS)", + ) expect(message.to).to include("test@example.com") + + email_body = message.body.raw_source + teacher = Teacher.find_by(email: "test@example.com") + if teacher.sign_in_count == 0 + expect(email_body).to include( + "Thank you for your interest in applying for qualified teacher status (QTS) in England.", + ) + expect(email_body).to_not include( + "Welcome back to apply for qualified teacher status (QTS) in England.", + ) + else + expect(email_body).to include( + "Welcome back to apply for qualified teacher status (QTS) in England.", + ) + expect(email_body).to_not include( + "Thank you for your interest in applying for qualified teacher status (QTS) in England.", + ) + end end def when_i_sign_in_using_magic_link message = ActionMailer::Base.deliveries.last - uri = URI.parse(message.body.raw_source.lines.fifth.chomp) + link_line = message.body.raw_source.lines.fifth.chomp + url = link_line.match(/\((http[^)]+)\)/)[1] + uri = URI.parse(url) expect(uri.path).to eq("/teacher/magic_link") expect(uri.query).to include("token") visit "#{uri.path}?#{uri.query}" diff --git a/spec/system/teacher_interface/further_information_spec.rb b/spec/system/teacher_interface/further_information_spec.rb index 7d79acfa64..4990498bc6 100644 --- a/spec/system/teacher_interface/further_information_spec.rb +++ b/spec/system/teacher_interface/further_information_spec.rb @@ -188,9 +188,7 @@ def and_i_receive_a_further_information_received_email message = ActionMailer::Base.deliveries.last expect(message).to_not be_nil - expect(message.subject).to eq( - "We’ve received the additional information you sent us", - ) + expect(message.subject).to eq("Your QTS application: information received") expect(message.to).to include(application_form.teacher.email) end diff --git a/spec/system/teacher_interface/submitting_spec.rb b/spec/system/teacher_interface/submitting_spec.rb index a0fd8adde4..77bb828227 100644 --- a/spec/system/teacher_interface/submitting_spec.rb +++ b/spec/system/teacher_interface/submitting_spec.rb @@ -58,9 +58,7 @@ def and_i_receive_an_application_email message = ActionMailer::Base.deliveries.last expect(message).to_not be_nil - expect(message.subject).to eq( - "We’ve received your application for qualified teacher status (QTS)", - ) + expect(message.subject).to eq("Your QTS application has been received") expect(message.to).to include("teacher@example.com") end