From 79456b8b89468a8db2632e347778f01e0fa745a1 Mon Sep 17 00:00:00 2001 From: Shujat Khalid Date: Thu, 30 May 2024 12:31:56 +0100 Subject: [PATCH] mail confirmation post submission NEW tests --- .../teacher_interface/authentication_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/system/teacher_interface/authentication_spec.rb b/spec/system/teacher_interface/authentication_spec.rb index f85531ad72..76c0545f18 100644 --- a/spec/system/teacher_interface/authentication_spec.rb +++ b/spec/system/teacher_interface/authentication_spec.rb @@ -160,6 +160,24 @@ def and_i_receive_a_teacher_magic_link_email "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