From 7dec74c3ceec596f6f57be7994f2d19ee8bc5907 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Mon, 1 Jul 2024 11:11:33 +0200 Subject: [PATCH] Fix repeated test issues This fixes issues related to repeated test blocks, context and test descriptions. --- .../personal_information_controller_spec.rb | 2 +- .../teacher_interface/uploads_controller_spec.rb | 2 +- spec/forms/teacher_interface/qualification_form_spec.rb | 7 ------- .../teacher_interface/sanction_confirmation_form_spec.rb | 2 +- spec/lib/application_form_section_status_updater_spec.rb | 2 +- spec/models/application_form_spec.rb | 2 +- spec/models/timeline_event_spec.rb | 4 ++-- spec/system/eligibility_spec.rb | 4 ++-- .../further_information_request_view_object_spec.rb | 2 +- .../teacher_interface/application_form_view_object_spec.rb | 2 +- 10 files changed, 11 insertions(+), 18 deletions(-) diff --git a/spec/controllers/teacher_interface/personal_information_controller_spec.rb b/spec/controllers/teacher_interface/personal_information_controller_spec.rb index 5848017658..415d7ed96e 100644 --- a/spec/controllers/teacher_interface/personal_information_controller_spec.rb +++ b/spec/controllers/teacher_interface/personal_information_controller_spec.rb @@ -28,7 +28,7 @@ end describe "GET alternative_name" do - subject(:perform) { get :name_and_date_of_birth } + subject(:perform) { get :alternative_name } include_examples "redirect unless application form is draft" end diff --git a/spec/controllers/teacher_interface/uploads_controller_spec.rb b/spec/controllers/teacher_interface/uploads_controller_spec.rb index 48198476ee..3b1c9bd235 100644 --- a/spec/controllers/teacher_interface/uploads_controller_spec.rb +++ b/spec/controllers/teacher_interface/uploads_controller_spec.rb @@ -37,7 +37,7 @@ describe "DELETE destroy" do subject(:perform) do - get :delete, params: { document_id: document.id, id: upload.id } + delete :delete, params: { document_id: document.id, id: upload.id } end let(:document) { create(:document, documentable: application_form) } diff --git a/spec/forms/teacher_interface/qualification_form_spec.rb b/spec/forms/teacher_interface/qualification_form_spec.rb index fb3d5f928d..77e8243b7c 100644 --- a/spec/forms/teacher_interface/qualification_form_spec.rb +++ b/spec/forms/teacher_interface/qualification_form_spec.rb @@ -68,13 +68,6 @@ it { is_expected.not_to be_valid } end - - context "with invalid dates" do - let(:complete_date) { { 1 => 2020, 2 => 1, 3 => 1 } } - let(:certificate_date) { { 1 => 2019, 2 => 1, 3 => 1 } } - - it { is_expected.not_to be_valid } - end end context "with a country code" do diff --git a/spec/forms/teacher_interface/sanction_confirmation_form_spec.rb b/spec/forms/teacher_interface/sanction_confirmation_form_spec.rb index ea0a7668ff..020e4111dc 100644 --- a/spec/forms/teacher_interface/sanction_confirmation_form_spec.rb +++ b/spec/forms/teacher_interface/sanction_confirmation_form_spec.rb @@ -23,7 +23,7 @@ end context "when confirmed is nil" do - let(:confirmed_no_sanctions) { false } + let(:confirmed_no_sanctions) { nil } it { is_expected.not_to be_valid } end diff --git a/spec/lib/application_form_section_status_updater_spec.rb b/spec/lib/application_form_section_status_updater_spec.rb index 72baaee682..7dd9f377e7 100644 --- a/spec/lib/application_form_section_status_updater_spec.rb +++ b/spec/lib/application_form_section_status_updater_spec.rb @@ -99,7 +99,7 @@ it { is_expected.to eq("completed") } end - context "with an incomplete qualification" do + context "with all complete qualifications and part of university degree" do let(:application_form) do create( :application_form, diff --git a/spec/models/application_form_spec.rb b/spec/models/application_form_spec.rb index d2acbcc71d..48b03eb0ea 100644 --- a/spec/models/application_form_spec.rb +++ b/spec/models/application_form_spec.rb @@ -421,7 +421,7 @@ end end - context "with no reminders sent" do + context "with one reminder sent" do let(:number_of_reminders_sent) { 1 } it { is_expected.to be false } diff --git a/spec/models/timeline_event_spec.rb b/spec/models/timeline_event_spec.rb index 39a93ba52e..7353913d36 100644 --- a/spec/models/timeline_event_spec.rb +++ b/spec/models/timeline_event_spec.rb @@ -257,7 +257,7 @@ end context "with a requestable requested event type" do - before { timeline_event.event_type = :requestable_received } + before { timeline_event.event_type = :requestable_requested } it { is_expected.to validate_absence_of(:assignee) } it { is_expected.to validate_absence_of(:assessment_section) } @@ -392,7 +392,7 @@ end context "with a requestable verified event type" do - before { timeline_event.event_type = :requestable_reviewed } + before { timeline_event.event_type = :requestable_verified } it { is_expected.to validate_absence_of(:assignee) } it { is_expected.to validate_absence_of(:assessment_section) } diff --git a/spec/system/eligibility_spec.rb b/spec/system/eligibility_spec.rb index 86a17d8f51..f9cf745df7 100644 --- a/spec/system/eligibility_spec.rb +++ b/spec/system/eligibility_spec.rb @@ -247,7 +247,7 @@ then_i_see_the(:eligibility_ineligible_page) end - it "ineligible path when filtering by country, not qualified in relevant subject" do + it "ineligible path when filtering by eligible country and not qualified in relevant subject" do when_i_visit_the(:eligibility_start_page) then_i_see_the(:eligibility_start_page) @@ -276,7 +276,7 @@ then_i_see_the(:eligibility_ineligible_page) end - it "ineligible path when filtering by country, not qualified in relevant subject" do + it "ineligible path when filtering by ineligible country and not qualified in relevant subject" do when_i_visit_the(:eligibility_start_page) then_i_see_the(:eligibility_start_page) diff --git a/spec/view_objects/assessor_interface/further_information_request_view_object_spec.rb b/spec/view_objects/assessor_interface/further_information_request_view_object_spec.rb index c28752ce94..a6edabcc85 100644 --- a/spec/view_objects/assessor_interface/further_information_request_view_object_spec.rb +++ b/spec/view_objects/assessor_interface/further_information_request_view_object_spec.rb @@ -85,7 +85,7 @@ context "when not passed and not recommended" do before do - further_information_request.update!(review_passed: true) + further_information_request.update!(review_passed: false) assessment.request_further_information! end diff --git a/spec/view_objects/teacher_interface/application_form_view_object_spec.rb b/spec/view_objects/teacher_interface/application_form_view_object_spec.rb index 25ad10aeb3..1abe368912 100644 --- a/spec/view_objects/teacher_interface/application_form_view_object_spec.rb +++ b/spec/view_objects/teacher_interface/application_form_view_object_spec.rb @@ -159,7 +159,7 @@ end end - context "with needs written statement" do + context "with needs registration number" do let(:needs_registration_number) { true } it do