diff --git a/app/assets/stylesheets/_email_preview.scss b/app/assets/stylesheets/_email_preview.scss deleted file mode 100644 index 964b2ba753..0000000000 --- a/app/assets/stylesheets/_email_preview.scss +++ /dev/null @@ -1,20 +0,0 @@ -.app-email-preview__header { - background-color: govuk-colour("black"); - color: govuk-colour("white"); - padding: govuk-spacing(2); -} - -.app-email-preview__header__logo { - font-size: 28px; - font-weight: bold; - width: 580px; - margin-left: auto; - margin-right: auto; -} - -.app-email-preview__content { - border-top: 10px govuk-colour("blue") solid; - width: 580px; - margin-left: auto; - margin-right: auto; -} diff --git a/app/assets/stylesheets/application.sass.scss b/app/assets/stylesheets/application.sass.scss index af652dc58a..b579f114b7 100644 --- a/app/assets/stylesheets/application.sass.scss +++ b/app/assets/stylesheets/application.sass.scss @@ -12,7 +12,6 @@ $moj-images-path: "/"; @import "_application_forms"; @import "_checkbox_search_filter"; @import "_description_list"; -@import "_email_preview"; @import "_environments"; @import "_search_results"; @import "_support"; diff --git a/app/components/preview_mailer/component.html.erb b/app/components/preview_mailer/component.html.erb deleted file mode 100644 index ceb282683b..0000000000 --- a/app/components/preview_mailer/component.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -
Missing GOV.UK Notify API key.
" if client.nil? - - client.generate_template_preview( - ApplicationMailer::GOVUK_NOTIFY_TEMPLATE_ID, - personalisation: { - to: mail.to.first, - subject: mail.subject, - body: mail.body.encoded, - }, - ).html - end -end diff --git a/app/policies/assessor_interface/further_information_request_policy.rb b/app/policies/assessor_interface/further_information_request_policy.rb index 5138eb264e..ae4b255fae 100644 --- a/app/policies/assessor_interface/further_information_request_policy.rb +++ b/app/policies/assessor_interface/further_information_request_policy.rb @@ -5,8 +5,6 @@ def create? user.assess_permission end - alias_method :preview?, :new? - def update? user.assess_permission end diff --git a/app/views/assessor_interface/assessment_recommendation_award/age_range_subjects.html.erb b/app/views/assessor_interface/assessment_recommendation_award/age_range_subjects.html.erb index 7ed40ae40d..e510a46c30 100644 --- a/app/views/assessor_interface/assessment_recommendation_award/age_range_subjects.html.erb +++ b/app/views/assessor_interface/assessment_recommendation_award/age_range_subjects.html.erb @@ -38,7 +38,6 @@ end end %> - +<%= form_with url: [:confirm, :assessor_interface, @application_form, @assessment, :assessment_recommendation_award] do |f| %> + <% render "shared/assessor_interface/continue_cancel_button", f: %> +<% end %> diff --git a/app/views/assessor_interface/assessment_recommendation_award/preview.html.erb b/app/views/assessor_interface/assessment_recommendation_award/preview.html.erb deleted file mode 100644 index 4fdfb77c98..0000000000 --- a/app/views/assessor_interface/assessment_recommendation_award/preview.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% content_for :page_title, t(".heading") %> -<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %> - -<%= t(".subheading") %>
-<%= t(".description") %>
- -<%= render(PreviewMailer::Component.new( - mailer_class: TeacherMailer, - name: :application_awarded, - application_form: @application_form, -)) %> - - diff --git a/app/views/assessor_interface/assessment_recommendation_decline/preview.html.erb b/app/views/assessor_interface/assessment_recommendation_decline/preview.html.erb deleted file mode 100644 index 8bc5fc6675..0000000000 --- a/app/views/assessor_interface/assessment_recommendation_decline/preview.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% content_for :page_title, t(".heading") %> -<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %> - -<%= t(".subheading") %>
-<%= t(".description") %>
- -<%= render(PreviewMailer::Component.new( - mailer_class: TeacherMailer, - name: :application_declined, - application_form: @application_form, -)) %> - - diff --git a/app/views/assessor_interface/further_information_requests/new.html.erb b/app/views/assessor_interface/further_information_requests/new.html.erb index 49a875b921..73627c54fc 100644 --- a/app/views/assessor_interface/further_information_requests/new.html.erb +++ b/app/views/assessor_interface/further_information_requests/new.html.erb @@ -1,16 +1,43 @@ -<% content_for :page_title, "Further information request email preview" %> -<% content_for :back_link_url, back_history_path(default: preview_assessor_interface_application_form_assessment_further_information_requests_path) %> +<% content_for :page_title, "Check the further information you’re asking the applicant for" %> +<% content_for :back_link_url, back_history_path(default: edit_assessor_interface_application_form_assessment_path(@application_form, @assessment)) %> -We were unable to verify the details for <%= items.first.work_history.school_name %>.
+ <% else %> +We were unable to verify the details for:
+<%= t(item.failure_reason_key, scope: %i[assessor_interface assessment_sections failure_reasons as_statement]) %>
+ +We were unable to verify the details for <%= items.first.work_history.school_name %>.
- <% else %> -We were unable to verify the details for:
-<%= t(item.failure_reason_key, scope: %i[assessor_interface assessment_sections failure_reasons as_statement]) %>
- -Preview
") } - - before do - expect(MailerPreview).to receive(:with).with( - mailer_class, - teacher:, - param:, - ).and_return(mailer) - end - - it "renders the header" do - expect(component.css(".app-email-preview__header").text.strip).to eq( - "GOV.UK", - ) - end - - it "renders the content" do - expect(component.css(".app-email-preview__content").text.strip).to eq( - "Preview", - ) - end -end diff --git a/spec/lib/mailer_preview_spec.rb b/spec/lib/mailer_preview_spec.rb deleted file mode 100644 index 43744c554a..0000000000 --- a/spec/lib/mailer_preview_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -require "rails_helper" - -RSpec.describe MailerPreview do - let(:further_information_request) { create(:further_information_request) } - let(:application_form) do - further_information_request.assessment.application_form - end - let(:teacher) { application_form.teacher } - let(:notify_key) { "notify-key" } - let(:notify_client) do - double(generate_template_preview: notify_template_preview) - end - let(:notify_template_preview) { double(html: "email html") } - - around do |example| - ClimateControl.modify GOVUK_NOTIFY_API_KEY: notify_key do - example.run - end - end - - before do - allow(Notifications::Client).to receive(:new).with(notify_key).and_return( - notify_client, - ) - end - - describe "render preview" do - subject do - described_class.with( - TeacherMailer, - application_form:, - further_information_request:, - ).further_information_requested - end - - it { is_expected.to eq("email html") } - - it "renders the correct template" do - expect(notify_client).to receive(:generate_template_preview).with( - "95adafaf-0920-4623-bddc-340853c047af", - instance_of(Hash), - ) - subject - end - - it "passes the correct parameters" do - expect(notify_client).to receive(:generate_template_preview).with( - instance_of(String), - personalisation: { - to: teacher.email, - subject: - "We need some more information to progress your QTS application", - body: instance_of(String), - }, - ) - subject - end - end -end diff --git a/spec/policies/assessor_interface/further_information_request_policy_spec.rb b/spec/policies/assessor_interface/further_information_request_policy_spec.rb index 73f2065ee5..6f4b315999 100644 --- a/spec/policies/assessor_interface/further_information_request_policy_spec.rb +++ b/spec/policies/assessor_interface/further_information_request_policy_spec.rb @@ -20,11 +20,6 @@ it_behaves_like "a policy method without permission" end - describe "#preview?" do - subject(:preview?) { policy.preview? } - it_behaves_like "a policy method requiring the assess permission" - end - describe "#create?" do subject(:create?) { policy.create? } it_behaves_like "a policy method requiring the assess permission" diff --git a/spec/support/autoload/page_objects/assessor_interface/age_range_subjects_assessment_recommendation_award.rb b/spec/support/autoload/page_objects/assessor_interface/age_range_subjects_assessment_recommendation_award.rb index 622c8a726a..8b2a6eaa29 100644 --- a/spec/support/autoload/page_objects/assessor_interface/age_range_subjects_assessment_recommendation_award.rb +++ b/spec/support/autoload/page_objects/assessor_interface/age_range_subjects_assessment_recommendation_award.rb @@ -8,7 +8,7 @@ class AgeRangeSubjectsAssessmentRecommendationAward < SitePrism::Page element :heading, "h1" section :summary_list, GovukSummaryList, ".govuk-summary-list" - element :continue_button, "a.govuk-button" + element :continue_button, ".govuk-button" end end end diff --git a/spec/support/autoload/page_objects/assessor_interface/further_information_request_preview.rb b/spec/support/autoload/page_objects/assessor_interface/further_information_request_preview.rb deleted file mode 100644 index 36993df526..0000000000 --- a/spec/support/autoload/page_objects/assessor_interface/further_information_request_preview.rb +++ /dev/null @@ -1,17 +0,0 @@ -module PageObjects - module AssessorInterface - class FurtherInformationRequestPreview < SitePrism::Page - set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \ - "/further-information-requests/new" - - element :email_preview, "div.app-email-preview" - - section :form, "form" do - element :send_to_applicant_button, - ".govuk-button:not(.govuk-button--secondary)" - element :back_to_overview_button, - ".govuk-button.govuk-button--secondary" - end - end - end -end diff --git a/spec/support/autoload/page_objects/assessor_interface/preview_assessment_recommendation.rb b/spec/support/autoload/page_objects/assessor_interface/preview_assessment_recommendation.rb deleted file mode 100644 index 1eb4369aa2..0000000000 --- a/spec/support/autoload/page_objects/assessor_interface/preview_assessment_recommendation.rb +++ /dev/null @@ -1,16 +0,0 @@ -module PageObjects - module AssessorInterface - class PreviewAssessmentRecommendation < SitePrism::Page - set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \ - "/recommendation/{recommendation}/preview" - - element :heading, "h1" - - section :email_preview, ".app-email-preview" do - element :content, ".app-email-preview__content" - end - - element :send_button, ".govuk-button" - end - end -end diff --git a/spec/support/autoload/page_objects/assessor_interface/request_further_information.rb b/spec/support/autoload/page_objects/assessor_interface/request_further_information.rb index eb490f5079..04267511df 100644 --- a/spec/support/autoload/page_objects/assessor_interface/request_further_information.rb +++ b/spec/support/autoload/page_objects/assessor_interface/request_further_information.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module PageObjects module AssessorInterface class RequestFurtherInformation < SitePrism::Page set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \ - "/further-information-requests/preview" + "/further-information-requests/new" sections :items, ".app-further-information-request-item" do element :heading, ".govuk-heading-s" diff --git a/spec/support/page_helpers.rb b/spec/support/page_helpers.rb index 3430bef35d..79f4ead034 100644 --- a/spec/support/page_helpers.rb +++ b/spec/support/page_helpers.rb @@ -122,11 +122,6 @@ def assessor_email_consent_letters_requests_assessment_recommendation_verify_pag PageObjects::AssessorInterface::EmailConsentLettersAssessmentRecommendationVerify.new end - def assessor_further_information_request_preview_page - @assessor_further_information_request_preview_page ||= - PageObjects::AssessorInterface::FurtherInformationRequestPreview.new - end - def assessor_locate_professional_standing_request_page @assessor_locate_professional_standing_request_page ||= PageObjects::AssessorInterface::LocateProfessionalStandingRequest.new @@ -136,11 +131,6 @@ def assessor_login_page @assessor_login_page ||= PageObjects::AssessorInterface::Login.new end - def assessor_preview_assessment_recommendation_page - @assessor_preview_assessment_recommendation_page ||= - PageObjects::AssessorInterface::PreviewAssessmentRecommendation.new - end - def assessor_professional_standing_assessment_recommendation_verify_page @assessor_professional_standing_assessment_recommendation_verify_page ||= PageObjects::AssessorInterface::ProfessionalStandingAssessmentRecommendationVerify.new diff --git a/spec/system/assessor_interface/completing_assessment_spec.rb b/spec/system/assessor_interface/completing_assessment_spec.rb index 3c672fe447..b50a268cda 100644 --- a/spec/system/assessor_interface/completing_assessment_spec.rb +++ b/spec/system/assessor_interface/completing_assessment_spec.rb @@ -3,27 +3,10 @@ require "rails_helper" RSpec.describe "Assessor completing assessment", type: :system do - let(:notify_key) { "notify-key" } - let(:notify_client) do - double(generate_template_preview: notify_template_preview) - end - let(:notify_template_preview) { double(html: "I am an email") } let(:assessor_user) do create(:staff, :with_assess_permission, :confirmed, name: "Authorized User") end - around do |example| - ClimateControl.modify GOVUK_NOTIFY_API_KEY: notify_key do - example.run - end - end - - before do - allow(Notifications::Client).to receive(:new).with(notify_key).and_return( - notify_client, - ) - end - it "award" do given_the_service_is_open given_i_am_authorized_as_an_assessor_user @@ -61,15 +44,6 @@ :assessor_age_range_subjects_assessment_recommendation_award_page, ) and_i_continue_from_age_range_subjects - - then_i_see_the( - :assessor_preview_assessment_recommendation_page, - reference:, - assessment_id:, - recommendation: "award", - ) - - when_i_send_the_email then_i_see_the( :assessor_confirm_assessment_recommendation_page, reference:, @@ -167,14 +141,6 @@ and_i_see_failure_reasons when_i_check_declaration - then_i_see_the( - :assessor_preview_assessment_recommendation_page, - reference:, - assessment_id:, - recommendation: "decline", - ) - - when_i_send_the_email then_i_see_the( :assessor_confirm_assessment_recommendation_page, reference:, @@ -370,10 +336,6 @@ def when_i_select_submit_verification_requests assessor_assessment_recommendation_verify_page.submit_button.click end - def when_i_send_the_email - assessor_preview_assessment_recommendation_page.send_button.click - end - def when_i_check_confirmation assessor_confirm_assessment_recommendation_page .form diff --git a/spec/system/assessor_interface/requesting_further_information_spec.rb b/spec/system/assessor_interface/requesting_further_information_spec.rb index 7dae7afc68..3fe6907622 100644 --- a/spec/system/assessor_interface/requesting_further_information_spec.rb +++ b/spec/system/assessor_interface/requesting_further_information_spec.rb @@ -3,24 +3,6 @@ require "rails_helper" RSpec.describe "Assessor requesting further information", type: :system do - let(:notify_key) { "notify-key" } - let(:notify_client) do - double(generate_template_preview: notify_template_preview) - end - let(:notify_template_preview) { double(html: "I am an email") } - - around do |example| - ClimateControl.modify GOVUK_NOTIFY_API_KEY: notify_key do - example.run - end - end - - before do - allow(Notifications::Client).to receive(:new).with(notify_key).and_return( - notify_client, - ) - end - it "completes an assessment" do given_the_service_is_open given_i_am_authorized_as_an_assessor_user @@ -41,15 +23,7 @@ ) and_i_see_the_further_information_request_items - when_i_click_continue_to_email_button - then_i_see_the( - :assessor_further_information_request_preview_page, - reference:, - assessment_id:, - ) - and_i_see_the_email_preview - - when_i_click_send_to_applicant + when_i_click_the_continue_button then_i_see_the(:assessor_application_status_page, reference:) and_i_receive_a_further_information_requested_email end @@ -78,23 +52,10 @@ def and_i_see_the_further_information_request_items ).to eq("A note.") end - def when_i_click_continue_to_email_button + def when_i_click_the_continue_button assessor_request_further_information_page.continue_button.click end - def and_i_see_the_email_preview - expect( - assessor_further_information_request_preview_page.email_preview, - ).to have_content("I am an email") - end - - def when_i_click_send_to_applicant - assessor_further_information_request_preview_page - .form - .send_to_applicant_button - .click - end - def and_i_receive_a_further_information_requested_email message = ActionMailer::Base.deliveries.last expect(message).to_not be_nil