From b64516f03b4feb94de5334bfb17cbdd5b9e6abaf Mon Sep 17 00:00:00 2001
From: Tomas D'Stefano
Date: Mon, 8 Jul 2024 17:00:02 +0100
Subject: [PATCH] Remove first page of the A levels
A levels are always required for a teacher degree apprenticeship
So no option for "No" so make sense to remove the first page of A levels
---
app/components/a_level_row_component.html.erb | 44 ++++++------
app/components/a_level_row_component.rb | 10 +--
.../courses/a_level_component/view.html.erb | 28 ++++----
.../find/courses/a_level_component/view.rb | 8 ---
.../view.html.erb | 4 +-
...els_required_for_this_course_controller.rb | 21 ------
app/decorators/course_decorator.rb | 4 --
app/helpers/view_helper.rb | 6 --
app/validators/a_level_course_validator.rb | 5 --
.../courses/_description_content.html.erb | 2 +-
.../add_a_level_to_a_list/new.html.erb | 2 +-
.../new.html.erb | 34 ---------
.../what_a_level_is_required/new.html.erb | 2 +-
...e_any_a_levels_required_for_this_course.rb | 28 --------
app/wizards/a_levels_wizard.rb | 1 -
app/wizards/a_levels_wizard_store.rb | 1 -
.../are_any_a_levels_required_store.rb | 24 -------
config/locales/en.yml | 9 ---
config/locales/find.yml | 1 -
config/routes/publish.rb | 2 -
spec/components/a_level_row_component_spec.rb | 18 +----
.../courses/a_level_component/view_spec.rb | 8 ---
...equired_for_this_course_controller_spec.rb | 13 ----
spec/decorators/course_decorator_spec.rb | 23 ------
.../editing_a_levels_tda_course_spec.rb | 45 +-----------
.../publish/courses/new_tda_course_spec.rb | 6 ++
...ship_course_with_validation_errors_spec.rb | 29 +-------
..._a_levels_required_for_this_course_spec.rb | 71 -------------------
spec/wizards/a_levels_wizard_store_spec.rb | 20 ------
.../are_any_a_levels_required_store_spec.rb | 70 ------------------
30 files changed, 51 insertions(+), 488 deletions(-)
delete mode 100644 app/controllers/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course_controller.rb
delete mode 100644 app/views/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course/new.html.erb
delete mode 100644 app/wizards/a_level_steps/are_any_a_levels_required_for_this_course.rb
delete mode 100644 app/wizards/are_any_a_levels_required_store.rb
delete mode 100644 spec/controllers/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course_controller_spec.rb
delete mode 100644 spec/wizards/a_level_steps/are_any_a_levels_required_for_this_course_spec.rb
delete mode 100644 spec/wizards/are_any_a_levels_required_store_spec.rb
diff --git a/app/components/a_level_row_component.html.erb b/app/components/a_level_row_component.html.erb
index 0413dfd603..3eb6b99788 100644
--- a/app/components/a_level_row_component.html.erb
+++ b/app/components/a_level_row_component.html.erb
@@ -13,32 +13,28 @@
<% end %>
<% end %>
<% elsif minimum_a_level_completed? %>
- <% if @course.a_level_requirements.present? %>
- <% Array(@course.a_level_subject_requirements).map do |a_level_subject_requirement| %>
-
- <%= a_level_subject_row_content(a_level_subject_requirement.with_indifferent_access) %>
-
- <% end %>
+ <% Array(@course.a_level_subject_requirements).map do |a_level_subject_requirement| %>
+
+ <%= a_level_subject_row_content(a_level_subject_requirement.with_indifferent_access) %>
+
+ <% end %>
- <% unless @course.accept_pending_a_level.nil? %>
-
- <%= pending_a_level_summary_content %>
-
- <% end %>
+ <% unless @course.accept_pending_a_level.nil? %>
+
+ <%= pending_a_level_summary_content %>
+
+ <% end %>
- <% unless @course.accept_a_level_equivalency.nil? %>
-
- <%= a_level_equivalency_summary_content %>
-
- <% end %>
+ <% unless @course.accept_a_level_equivalency.nil? %>
+
+ <%= a_level_equivalency_summary_content %>
+
+ <% end %>
- <% if @course.accept_a_level_equivalency? && @course.additional_a_level_equivalencies.present? %>
-
- <%= @course.additional_a_level_equivalencies %>
-
- <% end %>
- <% else %>
- <%= a_level_not_required_content %>
+ <% if @course.accept_a_level_equivalency? && @course.additional_a_level_equivalencies.present? %>
+
+ <%= @course.additional_a_level_equivalencies %>
+
<% end %>
<% else %>
<%= govuk_inset_text(classes: "app-inset-text--narrow-border app-inset-text--important") do %>
@@ -47,7 +43,7 @@
<%= govuk_link_to t("publish.providers.courses.description_content.enter_a_levels"),
- publish_provider_recruitment_cycle_course_a_levels_are_any_a_levels_required_for_this_course_path(
+ publish_provider_recruitment_cycle_course_a_levels_what_a_level_is_required_path(
course.provider.provider_code,
course.provider.recruitment_cycle_year,
course.course_code
diff --git a/app/components/a_level_row_component.rb b/app/components/a_level_row_component.rb
index cd5ceb1d57..5bfcd08930 100644
--- a/app/components/a_level_row_component.rb
+++ b/app/components/a_level_row_component.rb
@@ -8,7 +8,6 @@ class ALevelRowComponent < ViewComponent::Base
include ViewHelper
A_LEVEL_ERRORS = %i[
- a_level_requirements
a_level_subject_requirements
accept_pending_a_level
accept_a_level_equivalency
@@ -20,10 +19,6 @@ def initialize(course:, errors: nil)
@errors = errors
end
- def a_level_not_required_content
- I18n.t('publish.providers.courses.description_content.a_levels_not_required')
- end
-
def a_level_subject_row_content(a_level_subject_requirement)
a_level_subject_requirement_row_component = ALevelSubjectRequirementRowComponent.new(a_level_subject_requirement)
@@ -51,7 +46,6 @@ def a_level_errors
def wizard_step(a_level_error)
{
- a_level_requirements: :are_any_a_levels_required_for_this_course,
a_level_subject_requirements: :what_a_level_is_required,
accept_pending_a_level: :consider_pending_a_level,
accept_a_level_equivalency: :a_level_equivalencies
@@ -59,8 +53,6 @@ def wizard_step(a_level_error)
end
def minimum_a_level_completed?
- !course.a_level_requirements.nil? &&
- (course.a_level_requirements.blank? ||
- (course.a_level_requirements.present? && course.a_level_subject_requirements.present?))
+ course.a_level_subject_requirements.present?
end
end
diff --git a/app/components/find/courses/a_level_component/view.html.erb b/app/components/find/courses/a_level_component/view.html.erb
index 79127760ad..f7bec70e1c 100644
--- a/app/components/find/courses/a_level_component/view.html.erb
+++ b/app/components/find/courses/a_level_component/view.html.erb
@@ -1,17 +1,19 @@
-<% if a_levels_not_required? %>
-
<%= a_levels_not_required_content %>
-<% else %>
- <% a_level_subject_requirements.each do |a_level_subject_requirement| %>
-
- <%= a_level_subject_requirement %>
-
- <% end %>
+<% a_level_subject_requirements.each do |a_level_subject_requirement| %>
+
+ <%= a_level_subject_requirement %>
+
+<% end %>
+
+<% unless course.accept_pending_a_level.nil? %>
<%= pending_a_level_summary_content %>
+<% end %>
+
+<% unless course.accept_a_level_equivalency.nil? %>
<%= a_level_equivalency_summary_content %>
+<% end %>
- <% if course.accept_a_level_equivalency? && course.additional_a_level_equivalencies.present? %>
-
- <%= course.additional_a_level_equivalencies %>
-
- <% end %>
+<% if course.accept_a_level_equivalency? && course.additional_a_level_equivalencies.present? %>
+
+ <%= course.additional_a_level_equivalencies %>
+
<% end %>
diff --git a/app/components/find/courses/a_level_component/view.rb b/app/components/find/courses/a_level_component/view.rb
index a6353b9166..f33636f73d 100644
--- a/app/components/find/courses/a_level_component/view.rb
+++ b/app/components/find/courses/a_level_component/view.rb
@@ -13,14 +13,6 @@ def initialize(course:)
super
end
- def a_levels_not_required?
- course.a_levels_requirements_answered? && course.a_level_requirements.blank?
- end
-
- def a_levels_not_required_content
- I18n.t('find.courses.a_level.a_levels_not_required')
- end
-
def a_level_subject_requirements
GroupedALevelSubjectRequirements.new(course).to_a_level_equivalency_array
end
diff --git a/app/components/find/courses/teacher_degree_apprenticeship_entry_requirements/view.html.erb b/app/components/find/courses/teacher_degree_apprenticeship_entry_requirements/view.html.erb
index c296c2917c..d84c997e51 100644
--- a/app/components/find/courses/teacher_degree_apprenticeship_entry_requirements/view.html.erb
+++ b/app/components/find/courses/teacher_degree_apprenticeship_entry_requirements/view.html.erb
@@ -1,7 +1,5 @@
A levels
-<% if course.a_levels_requirements_answered? %>
- <%= render Find::Courses::ALevelComponent::View.new(course:) %>
-<% end %>
+<%= render Find::Courses::ALevelComponent::View.new(course:) %>
GCSEs
diff --git a/app/controllers/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course_controller.rb b/app/controllers/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course_controller.rb
deleted file mode 100644
index 0873088bdb..0000000000
--- a/app/controllers/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course_controller.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-module Publish
- module Courses
- module ALevelRequirements
- class AreAnyALevelsRequiredForThisCourseController < ALevelRequirementsController
- private
-
- def step_params
- if @course_decorator.a_levels_requirements_answered? && params[current_step].blank?
- ActionController::Parameters.new(
- current_step => { answer: @course.a_level_requirements? ? 'yes' : 'no' }
- )
- else
- params
- end
- end
- end
- end
- end
-end
diff --git a/app/decorators/course_decorator.rb b/app/decorators/course_decorator.rb
index 6bc7f95ca9..ed2d25ea67 100644
--- a/app/decorators/course_decorator.rb
+++ b/app/decorators/course_decorator.rb
@@ -303,10 +303,6 @@ def gcse_section_complete?
!object.accept_pending_gcse.nil? && !object.accept_gcse_equivalency.nil?
end
- def a_levels_requirements_answered?
- !object.a_level_requirements.nil?
- end
-
def about_course
object.enrichment_attribute(:about_course)
end
diff --git a/app/helpers/view_helper.rb b/app/helpers/view_helper.rb
index 43f85f98a7..dce728ae2d 100644
--- a/app/helpers/view_helper.rb
+++ b/app/helpers/view_helper.rb
@@ -64,12 +64,6 @@ def enrichment_error_url(provider_code:, course:, field:, message: nil)
study_sites: (course.provider&.study_sites&.none? ? "#{provider_base}/study-sites" : "#{base}/study-sites").to_s,
accrediting_provider: accredited_provider_publish_provider_recruitment_cycle_course_path(course.provider_code, course.recruitment_cycle_year, course.course_code),
applications_open_from: "#{base}/applications-open",
- a_level_requirements: publish_provider_recruitment_cycle_course_a_levels_are_any_a_levels_required_for_this_course_path(
- course.provider_code,
- course.provider.recruitment_cycle_year,
- course.course_code,
- display_errors: true
- ),
a_level_subject_requirements: publish_provider_recruitment_cycle_course_a_levels_what_a_level_is_required_path(
course.provider_code,
course.provider.recruitment_cycle_year,
diff --git a/app/validators/a_level_course_validator.rb b/app/validators/a_level_course_validator.rb
index 1800749f49..8e69d830a8 100644
--- a/app/validators/a_level_course_validator.rb
+++ b/app/validators/a_level_course_validator.rb
@@ -2,12 +2,7 @@
class ALevelCourseValidator < ActiveModel::Validator
def validate(record)
- return record.errors.add(:a_level_requirements, :blank) if record.a_level_requirements.nil?
-
- return if record.a_level_requirements.blank? # No A level required
-
return record.errors.add(:a_level_subject_requirements, :blank) if record.a_level_subject_requirements.blank?
-
return record.errors.add(:accept_pending_a_level, :blank) if record.accept_pending_a_level.nil?
record.errors.add(:accept_a_level_equivalency, :blank) if record.accept_a_level_equivalency.nil?
diff --git a/app/views/publish/courses/_description_content.html.erb b/app/views/publish/courses/_description_content.html.erb
index 093551d8e7..faa48d86fc 100644
--- a/app/views/publish/courses/_description_content.html.erb
+++ b/app/views/publish/courses/_description_content.html.erb
@@ -137,7 +137,7 @@
t("publish.providers.courses.description_content.a_levels_label"),
(render ALevelRowComponent.new(course:, errors: @errors)),
%w[a_level_requirements a_level_subject_requirements accept_pending_a_level accept_a_level_equivalency],
- action_path: publish_provider_recruitment_cycle_course_a_levels_are_any_a_levels_required_for_this_course_path(
+ action_path: publish_provider_recruitment_cycle_course_a_levels_what_a_level_is_required_path(
@provider.provider_code,
@provider.recruitment_cycle_year,
course.course_code
diff --git a/app/views/publish/courses/a_level_requirements/add_a_level_to_a_list/new.html.erb b/app/views/publish/courses/a_level_requirements/add_a_level_to_a_list/new.html.erb
index 7d3be43ea1..f26278ec08 100644
--- a/app/views/publish/courses/a_level_requirements/add_a_level_to_a_list/new.html.erb
+++ b/app/views/publish/courses/a_level_requirements/add_a_level_to_a_list/new.html.erb
@@ -3,7 +3,7 @@
<% content_for :before_content do %>
<% if @wizard.current_step.maximum_number_of_a_level_subjects? %>
<%= govuk_back_link_to(
- publish_provider_recruitment_cycle_course_a_levels_are_any_a_levels_required_for_this_course_path(
+ publish_provider_recruitment_cycle_course_path(
@provider.provider_code,
@provider.recruitment_cycle_year,
@course.course_code
diff --git a/app/views/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course/new.html.erb b/app/views/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course/new.html.erb
deleted file mode 100644
index f09150c676..0000000000
--- a/app/views/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course/new.html.erb
+++ /dev/null
@@ -1,34 +0,0 @@
-<% content_for :page_title, title_with_error_prefix(t("course.#{@wizard.current_step.model_name.i18n_key}.heading"), @wizard.current_step.errors && @wizard.current_step.errors.any?) %>
-
-<% content_for :before_content do %>
- <%= govuk_back_link_to(
- publish_provider_recruitment_cycle_course_path(
- @provider.provider_code,
- @provider.recruitment_cycle_year,
- @course.course_code
- )
- ) %>
-<% end %>
-
-
-
- <%= form_with model: @wizard.current_step, url:
- publish_provider_recruitment_cycle_course_a_levels_are_any_a_levels_required_for_this_course_path(
- @provider.provider_code,
- @provider.recruitment_cycle_year,
- @course.course_code
- ) do |form| %>
- <%= form.govuk_error_summary %>
- <%= form.govuk_radio_buttons_fieldset :answer, legend: { size: "xl", text: t("course.#{@wizard.current_step.model_name.i18n_key}.heading"), tag: "h1" }, caption: { text: @course_decorator.name_and_code, size: "l" } do %>
- <%= form.govuk_radio_button :answer, :yes, label: { text: t("course.are_any_a_levels_required_for_this_course.answer_yes") }, link_errors: true %>
- <%= form.govuk_radio_button :answer, :no, label: { text: t("course.are_any_a_levels_required_for_this_course.answer_no") } %>
- <% end %>
-
- <%= form.submit t("continue"), class: "govuk-button" %>
- <% end %>
-
-
- <%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_course_path(@provider.provider_code, @provider.recruitment_cycle_year, @course.course_code)) %>
-
-
-
diff --git a/app/views/publish/courses/a_level_requirements/what_a_level_is_required/new.html.erb b/app/views/publish/courses/a_level_requirements/what_a_level_is_required/new.html.erb
index b4f94575ba..faad099135 100644
--- a/app/views/publish/courses/a_level_requirements/what_a_level_is_required/new.html.erb
+++ b/app/views/publish/courses/a_level_requirements/what_a_level_is_required/new.html.erb
@@ -11,7 +11,7 @@
) %>
<% else %>
<%= govuk_back_link_to(
- publish_provider_recruitment_cycle_course_a_levels_are_any_a_levels_required_for_this_course_path(
+ publish_provider_recruitment_cycle_course_path(
@provider.provider_code,
@provider.recruitment_cycle_year,
@course.course_code
diff --git a/app/wizards/a_level_steps/are_any_a_levels_required_for_this_course.rb b/app/wizards/a_level_steps/are_any_a_levels_required_for_this_course.rb
deleted file mode 100644
index 0b89f96013..0000000000
--- a/app/wizards/a_level_steps/are_any_a_levels_required_for_this_course.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-module ALevelSteps
- class AreAnyALevelsRequiredForThisCourse < DfE::Wizard::Step
- delegate :course, :exit_path, to: :wizard
- attr_accessor :answer
-
- validates :answer, presence: true
-
- def self.permitted_params
- [:answer]
- end
-
- def previous_step
- :first_step
- end
-
- def next_step
- return :exit if answer == 'no'
-
- if answer == 'yes' && course.a_level_subject_requirements.present?
- :add_a_level_to_a_list
- else
- :what_a_level_is_required
- end
- end
- end
-end
diff --git a/app/wizards/a_levels_wizard.rb b/app/wizards/a_levels_wizard.rb
index 60df08dce9..39c974bca5 100644
--- a/app/wizards/a_levels_wizard.rb
+++ b/app/wizards/a_levels_wizard.rb
@@ -9,7 +9,6 @@ class ALevelsWizard < DfE::Wizard::Base
steps do
[
- { are_any_a_levels_required_for_this_course: ALevelSteps::AreAnyALevelsRequiredForThisCourse },
{ what_a_level_is_required: ALevelSteps::WhatALevelIsRequired },
{ add_a_level_to_a_list: ALevelSteps::AddALevelToAList },
{ remove_a_level_subject_confirmation: ALevelSteps::RemoveALevelSubjectConfirmation },
diff --git a/app/wizards/a_levels_wizard_store.rb b/app/wizards/a_levels_wizard_store.rb
index a6b8e9be17..3ff6a2727d 100644
--- a/app/wizards/a_levels_wizard_store.rb
+++ b/app/wizards/a_levels_wizard_store.rb
@@ -6,7 +6,6 @@ class ALevelsWizardStore < DfE::Wizard::Store
def save
return false unless valid_step?
- AreAnyALevelsRequiredStore.new(wizard).save if current_step_name == :are_any_a_levels_required_for_this_course
WhatALevelIsRequiredStore.new(wizard).save if current_step_name == :what_a_level_is_required
ConsiderPendingALevelStore.new(wizard).save if current_step_name == :consider_pending_a_level
ALevelEquivalenciesStore.new(wizard).save if current_step_name == :a_level_equivalencies
diff --git a/app/wizards/are_any_a_levels_required_store.rb b/app/wizards/are_any_a_levels_required_store.rb
deleted file mode 100644
index d51288406f..0000000000
--- a/app/wizards/are_any_a_levels_required_store.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class AreAnyALevelsRequiredStore < DfE::Wizard::Store
- delegate :course, to: :wizard
-
- def save
- updated_attributes = { a_level_requirements: }
- unless a_level_requirements?
- updated_attributes.merge!(
- a_level_subject_requirements: [],
- accept_pending_a_level: nil,
- accept_a_level_equivalency: nil,
- additional_a_level_equivalencies: nil
- )
- end
-
- course.update!(updated_attributes)
- end
-
- def a_level_requirements?
- current_step.answer == 'yes'
- end
- alias a_level_requirements a_level_requirements?
-end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 10458147fb..63a79f788b 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -332,10 +332,6 @@ en:
open: "Course opened"
closed: "Course closed"
add_course: "Add course"
- are_any_a_levels_required_for_this_course:
- heading: Are any A levels required for this course?
- answer_yes: "Yes"
- answer_no: "No"
what_a_level_is_required:
heading: What A level is required?
success_message: You have added a required A level
@@ -433,7 +429,6 @@ en:
enter_a_levels: Enter A levels and equivalency test requirements
a_levels_heading: A levels and equivalency tests
a_levels_label: A levels
- a_levels_not_required: A levels are not required for this course
course_length:
edit:
course_length: Course length
@@ -880,10 +875,6 @@ en:
description:
blank: Enter details about the accredited provider
too_long: Description about the accredited provider must be 100 words or fewer
- are_any_a_levels_required_for_this_course:
- attributes:
- answer:
- blank: Select if this course requires any A levels
what_a_level_is_required:
attributes:
subject:
diff --git a/config/locales/find.yml b/config/locales/find.yml
index bd94fd0309..b391037aac 100644
--- a/config/locales/find.yml
+++ b/config/locales/find.yml
@@ -79,7 +79,6 @@ en:
heading: School placements at %{provider_name}
back: Back to %{course_name} (%{course_code})
a_level:
- a_levels_not_required: A levels are not required for this course
consider_pending_a_level: We’ll consider candidates with pending A levels.
not_consider_pending_a_level: We will not consider candidates with pending A levels.
consider_a_level_equivalency: We’ll consider candidates who need to take A level equivalency tests.
diff --git a/config/routes/publish.rb b/config/routes/publish.rb
index 258ce4b18d..b077ff63d4 100644
--- a/config/routes/publish.rb
+++ b/config/routes/publish.rb
@@ -160,8 +160,6 @@
get '/age_range', on: :member, to: 'courses/age_range#edit'
put '/age_range', on: :member, to: 'courses/age_range#update'
- get '/a-levels-or-equivalency-tests/required-for-this-course', to: 'courses/a_level_requirements/are_any_a_levels_required_for_this_course#new', as: :a_levels_are_any_a_levels_required_for_this_course
- post '/a-levels-or-equivalency-tests/required-for-this-course', to: 'courses/a_level_requirements/are_any_a_levels_required_for_this_course#create'
get '/a-levels-or-equivalency-tests/what-a-level-is-required(/:uuid)', to: 'courses/a_level_requirements/what_a_level_is_required#new', as: :a_levels_what_a_level_is_required
post '/a-levels-or-equivalency-tests/what-a-level-is-required', to: 'courses/a_level_requirements/what_a_level_is_required#create'
get '/a-levels-or-equivalency-tests/add-a-level-to-list', to: 'courses/a_level_requirements/add_a_level_to_a_list#new', as: :a_levels_add_a_level_to_a_list
diff --git a/spec/components/a_level_row_component_spec.rb b/spec/components/a_level_row_component_spec.rb
index 6938a9967d..a4858a8dd1 100644
--- a/spec/components/a_level_row_component_spec.rb
+++ b/spec/components/a_level_row_component_spec.rb
@@ -5,18 +5,6 @@
RSpec.describe ALevelRowComponent do
include Rails.application.routes.url_helpers
- let(:a_level_subject_requirement) do
- { 'subject' => 'other_subject', 'other_subject' => 'Math', 'minimum_grade_required' => 'A' }
- end
-
- it 'renders the a_level_not_required_content when a level requirements are not present' do
- course = create(:course, a_level_requirements: false)
- component = described_class.new(course: course.decorate)
- rendered_component = render_inline(component)
-
- expect(rendered_component.text).to include(I18n.t('publish.providers.courses.description_content.a_levels_not_required'))
- end
-
it 'does render to enter A levels when not A levels are answered' do
course = create(:course, a_level_requirements: nil)
component = described_class.new(course: course.decorate)
@@ -155,13 +143,13 @@
end
context 'when a_level_requirements is nil' do
- let(:attributes) { { a_level_requirements: nil } }
+ let(:attributes) { { a_level_requirements: nil, a_level_subject_requirements: [] } }
it 'renders the error message for a_level_requirements' do
- expect(rendered_component).to have_text(I18n.t("course.#{component.wizard_step(:a_level_requirements)}.heading"))
+ expect(rendered_component).to have_text(I18n.t("course.#{component.wizard_step(:a_level_subject_requirements)}.heading"))
expect(rendered_component).to have_link(
component.errors[:a_level_requirements].first,
- href: publish_provider_recruitment_cycle_course_a_levels_are_any_a_levels_required_for_this_course_path(
+ href: publish_provider_recruitment_cycle_course_a_levels_what_a_level_is_required_path(
course.provider.provider_code,
course.provider.recruitment_cycle_year,
course.course_code,
diff --git a/spec/components/find/courses/a_level_component/view_spec.rb b/spec/components/find/courses/a_level_component/view_spec.rb
index 2140277af5..5ac0bea5a0 100644
--- a/spec/components/find/courses/a_level_component/view_spec.rb
+++ b/spec/components/find/courses/a_level_component/view_spec.rb
@@ -8,14 +8,6 @@
let(:course) { create(:course, a_level_subject_requirements:).decorate }
let(:a_level_subject_requirements) { [] }
- context 'when A-levels are not required' do
- let(:course) { create(:course, a_level_requirements: false).decorate }
-
- it 'renders the correct content' do
- expect(result).to include('A levels are not required for this course')
- end
- end
-
context 'with up to 4 singular subjects' do
let(:a_level_subject_requirements) do
[
diff --git a/spec/controllers/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course_controller_spec.rb b/spec/controllers/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course_controller_spec.rb
deleted file mode 100644
index 6376aa326f..0000000000
--- a/spec/controllers/publish/courses/a_level_requirements/are_any_a_levels_required_for_this_course_controller_spec.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-require 'rails_helper'
-
-module Publish
- module Courses
- module ALevelRequirements
- describe AreAnyALevelsRequiredForThisCourseController do
- it_behaves_like 'an A level requirements controller'
- end
- end
- end
-end
diff --git a/spec/decorators/course_decorator_spec.rb b/spec/decorators/course_decorator_spec.rb
index d6a09e7a97..ccfb60fc63 100644
--- a/spec/decorators/course_decorator_spec.rb
+++ b/spec/decorators/course_decorator_spec.rb
@@ -226,29 +226,6 @@
# end
# end
- describe '#a_levels_requirements_answered?' do
- context 'when a_level_requirements is nil' do
- it 'returns false' do
- course.a_level_requirements = nil
- expect(decorated_course.a_levels_requirements_answered?).to be false
- end
- end
-
- context 'when a_level_requirements is true' do
- it 'returns true' do
- course.a_level_requirements = true
- expect(decorated_course.a_levels_requirements_answered?).to be true
- end
- end
-
- context 'when a_level_requirements is false' do
- it 'returns true' do
- course.a_level_requirements = false
- expect(decorated_course.a_levels_requirements_answered?).to be true
- end
- end
- end
-
describe '#subject_present?' do
it 'returns true when the subject id exists' do
expect(decorated_course.subject_present?(english)).to be(true)
diff --git a/spec/features/publish/courses/editing_a_levels_tda_course_spec.rb b/spec/features/publish/courses/editing_a_levels_tda_course_spec.rb
index 41e8d01f71..6280e7e696 100644
--- a/spec/features/publish/courses/editing_a_levels_tda_course_spec.rb
+++ b/spec/features/publish/courses/editing_a_levels_tda_course_spec.rb
@@ -12,30 +12,10 @@
then_i_see_a_levels_row
when_i_click_to_add_a_level_requirements
- then_i_am_on_the_a_levels_required_for_the_course_page
+ then_i_am_on_the_what_a_level_is_required_page
and_the_back_link_points_to_description_tab
when_i_click_continue
- then_i_see_an_error_message_for_the_a_levels_required_for_the_course_page
-
- when_i_choose_no
- and_i_click_continue
- then_i_am_on_the_course_description_tab
- and_i_see_a_levels_is_no_required
-
- when_i_click_to_change_a_level_requirements
- then_i_am_on_the_a_levels_required_for_the_course_page
- and_the_no_option_is_chosen
-
- when_i_choose_yes
- and_i_click_continue
- then_i_am_on_the_what_a_level_is_required_page
-
- when_i_click_back
- then_the_yes_option_is_chosen
- and_i_click_continue
-
- and_i_click_continue
then_i_see_an_error_message_for_the_what_a_levels_is_required_for_the_course_page
when_i_choose_other_subject
@@ -79,14 +59,7 @@
and_i_click_continue
then_i_see_the_four_subjects_i_already_added
and_i_do_not_see_the_option_to_add_more_a_level_subjects
-
- when_i_click_back
- then_i_am_on_the_a_levels_required_for_the_course_page
and_the_back_link_points_to_description_tab
- and_the_yes_option_is_chosen
-
- when_i_click_continue
- then_i_am_on_the_add_another_a_level_subject_page
when_i_click_continue
then_i_am_on_the_consider_pending_a_level_page
@@ -128,7 +101,6 @@
and_i_see_the_a_level_requirements_for_the_course
when_i_click_to_change_a_level_requirements
- and_i_click_continue
and_i_click_to_change_the_subject
then_i_am_on_the_what_a_level_is_required_page_editing_the_subject
and_the_back_link_points_to_add_a_level_to_the_list
@@ -200,26 +172,11 @@ def when_i_click_to_add_a_level_requirements
click_on 'Enter A levels and equivalency test requirements'
end
- def then_i_am_on_the_a_levels_required_for_the_course_page
- expect(page).to have_current_path(
- publish_provider_recruitment_cycle_course_a_levels_are_any_a_levels_required_for_this_course_path(
- @provider.provider_code,
- 2025,
- @course.course_code
- )
- )
- end
-
def when_i_click_continue
click_on 'Continue'
end
alias_method :and_i_click_continue, :when_i_click_continue
- def then_i_see_an_error_message_for_the_a_levels_required_for_the_course_page
- expect(page.title).to eq('Error: Are any A levels required for this course? - Publish teacher training courses - GOV.UK')
- expect(page).to have_content('Select if this course requires any A levels').twice
- end
-
def when_i_choose_no
choose 'No'
end
diff --git a/spec/features/publish/courses/new_tda_course_spec.rb b/spec/features/publish/courses/new_tda_course_spec.rb
index 235c2c78f4..aa7723e152 100644
--- a/spec/features/publish/courses/new_tda_course_spec.rb
+++ b/spec/features/publish/courses/new_tda_course_spec.rb
@@ -655,8 +655,14 @@ def then_i_am_on_the_funding_type_page
def and_i_add_a_level_requirements
click_on 'Enter A levels and equivalency test requirements'
+ choose 'Any subject'
+ and_i_click_continue
choose 'No'
and_i_click_continue
+ choose 'Yes'
+ and_i_click_continue
+ choose 'Yes'
+ click_on 'Update A levels'
end
alias_method :and_i_do_not_see_the_change_links_for_study_mode_funding_type_and_visa_sponsorship, :then_i_do_not_see_the_change_links_for_study_mode_funding_type_and_visa_sponsorship
diff --git a/spec/features/publish/courses/publishing_a_teacher_degree_apprenticeship_course_with_validation_errors_spec.rb b/spec/features/publish/courses/publishing_a_teacher_degree_apprenticeship_course_with_validation_errors_spec.rb
index 873c69f36d..23058808e7 100644
--- a/spec/features/publish/courses/publishing_a_teacher_degree_apprenticeship_course_with_validation_errors_spec.rb
+++ b/spec/features/publish/courses/publishing_a_teacher_degree_apprenticeship_course_with_validation_errors_spec.rb
@@ -8,21 +8,10 @@
and_the_tda_feature_flag_is_active
and_there_is_an_invalid_tda_course_i_want_to_publish
- when_i_visit_the_course_page
- and_i_click_the_publish_link
- then_i_see_a_level_is_required
- and_i_see_a_level_is_required_in_a_level_row
-
- when_i_click_on_the_a_level_is_required_error
- then_i_am_on_the_a_levels_required_for_the_course_page
- and_i_see_a_level_required_error
-
- when_i_choose_yes
- and_i_click_continue
-
when_i_visit_the_course_page
and_i_click_the_publish_link
then_i_see_a_level_subject_is_required
+
when_i_click_on_the_a_level_is_required_error
then_i_am_on_the_what_a_levels_is_required_for_the_course_page
and_i_see_what_a_level_required_error
@@ -117,11 +106,6 @@ def and_i_click_the_publish_link
end
alias_method :when_i_click_the_publish_link, :and_i_click_the_publish_link
- def then_i_see_a_level_is_required
- and_i_see_that_i_need_to_enter_a_level_requirements
- expect(page).to have_content('Are any A levels required for this course?')
- end
-
def then_i_see_a_level_subject_is_required
and_i_see_that_i_need_to_enter_a_level_requirements
expect(page).to have_content('What A level is required?')
@@ -137,17 +121,6 @@ def and_i_see_a_level_is_required_in_a_level_row
expect(page).to have_content('Enter A level requirements').twice
end
- def then_i_am_on_the_a_levels_required_for_the_course_page
- expect(page).to have_current_path(
- publish_provider_recruitment_cycle_course_a_levels_are_any_a_levels_required_for_this_course_path(
- @provider.provider_code,
- 2025,
- @course.course_code,
- display_errors: true
- )
- )
- end
-
def when_i_click_on_the_a_level_is_required_error
click_on 'Enter A level requirements', match: :first
end
diff --git a/spec/wizards/a_level_steps/are_any_a_levels_required_for_this_course_spec.rb b/spec/wizards/a_level_steps/are_any_a_levels_required_for_this_course_spec.rb
deleted file mode 100644
index 5c776a4b9f..0000000000
--- a/spec/wizards/a_level_steps/are_any_a_levels_required_for_this_course_spec.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-# frozen_string_literal: true
-
-require 'rails_helper'
-
-RSpec.describe ALevelSteps::AreAnyALevelsRequiredForThisCourse do
- subject(:wizard_step) { described_class.new(wizard:) }
-
- let(:provider) { create(:provider) }
- let(:wizard) do
- ALevelsWizard.new(
- current_step: :are_any_a_levels_required_for_this_course,
- provider:,
- course:,
- step_params: ActionController::Parameters.new({})
- )
- end
- let(:course) { create(:course, :with_teacher_degree_apprenticeship, provider:) }
-
- describe 'validations' do
- it 'is valid with a valid answer' do
- wizard_step.answer = 'yes'
- expect(wizard_step).to be_valid
-
- wizard_step.answer = 'no'
- expect(wizard_step).to be_valid
- end
-
- it 'is not valid without an answer' do
- wizard_step.answer = nil
- expect(wizard_step).not_to be_valid
- expect(wizard_step.errors.added?(:answer, :blank)).to be true
- end
- end
-
- describe '.permitted_params' do
- it 'returns the permitted params' do
- expect(described_class.permitted_params).to eq([:answer])
- end
- end
-
- describe '#previous_step' do
- it 'returns the symbol for the previous step' do
- expect(wizard_step.previous_step).to eq(:first_step)
- end
- end
-
- describe '#next_step' do
- context 'when a level is required' do
- it 'returns the name for the next step' do
- wizard_step.answer = 'yes'
- expect(wizard_step.next_step).to eq(:what_a_level_is_required)
- end
- end
-
- context 'when a level is required and a level subjects added already' do
- let(:course) { create(:course, :with_teacher_degree_apprenticeship, :with_a_level_requirements) }
-
- it 'returns the name for the next step' do
- wizard_step.answer = 'yes'
- expect(wizard_step.next_step).to eq(:add_a_level_to_a_list)
- end
- end
-
- context 'when a level is not required' do
- it 'returns the name for the next step' do
- wizard_step.answer = 'no'
- expect(wizard_step.next_step).to eq(:exit)
- end
- end
- end
-end
diff --git a/spec/wizards/a_levels_wizard_store_spec.rb b/spec/wizards/a_levels_wizard_store_spec.rb
index 2e55bd93e4..f5355b1da1 100644
--- a/spec/wizards/a_levels_wizard_store_spec.rb
+++ b/spec/wizards/a_levels_wizard_store_spec.rb
@@ -34,25 +34,6 @@
end
end
- context 'when current step name is :are_any_a_levels_required_for_this_course' do
- let(:current_step) { :are_any_a_levels_required_for_this_course }
- let(:step_params) { {} }
-
- before do
- allow(wizard).to receive(:valid_step?).and_return(true)
- end
-
- it 'calls save on AreAnyALevelsRequiredStore' do
- are_any_store = instance_double(AreAnyALevelsRequiredStore)
- allow(AreAnyALevelsRequiredStore).to receive(:new).with(wizard).and_return(are_any_store)
- allow(are_any_store).to receive(:save)
-
- subject
-
- expect(are_any_store).to have_received(:save)
- end
- end
-
context 'when current step name is :what_a_level_is_required' do
let(:current_step) { :what_a_level_is_required }
let(:step_params) { {} }
@@ -119,7 +100,6 @@
end
it 'does not call any store save method' do
- expect(AreAnyALevelsRequiredStore).not_to receive(:new)
expect(WhatALevelIsRequiredStore).not_to receive(:new)
expect(ConsiderPendingALevelStore).not_to receive(:new)
expect(ALevelEquivalenciesStore).not_to receive(:new)
diff --git a/spec/wizards/are_any_a_levels_required_store_spec.rb b/spec/wizards/are_any_a_levels_required_store_spec.rb
deleted file mode 100644
index 2f6b2a7b26..0000000000
--- a/spec/wizards/are_any_a_levels_required_store_spec.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-# frozen_string_literal: true
-
-require 'rails_helper'
-
-RSpec.describe AreAnyALevelsRequiredStore do
- subject(:store) { described_class.new(wizard) }
-
- let(:course) { create(:course) }
- let(:provider) { build(:provider) }
- let(:current_step) { :are_any_a_levels_required_for_this_course }
-
- let(:wizard) do
- ALevelsWizard.new(
- current_step:,
- provider:,
- course:,
- step_params: ActionController::Parameters.new(
- { current_step => ActionController::Parameters.new(step_params) }
- )
- )
- end
-
- describe '#save' do
- subject { store.save }
-
- context 'when current step answer is yes' do
- let(:step_params) { { answer: 'yes' } }
-
- it 'updates course a_level_requirements to true' do
- expect { subject }.to change { course.reload.a_level_requirements }.to(true)
- end
- end
-
- context 'when current step answer is yes and existing a level subject requirements' do
- let(:course) { create(:course, :with_teacher_degree_apprenticeship, :with_a_level_requirements) }
- let(:step_params) { { answer: 'yes' } }
-
- it 'preserve existing a level subject requirements' do
- expect(course.a_level_subject_requirements).to be_present
- store.save
- expect(course.a_level_subject_requirements).to be_present
- end
- end
-
- context 'when current step answer is no' do
- let(:step_params) { { answer: 'no' } }
-
- it 'updates course a_level_requirements to false' do
- expect { subject }.to change { course.reload.a_level_requirements }.to(false)
- end
- end
-
- context 'when current step answer is no and existing a level subject requirements' do
- let(:course) { create(:course, :with_teacher_degree_apprenticeship, :with_a_level_requirements) }
- let(:step_params) { { answer: 'no' } }
-
- it 'remove existing a level fields' do
- expect(course.a_level_subject_requirements).to be_present
-
- store.save
- course.reload
-
- expect(course.a_level_subject_requirements).to eq([])
- expect(course.accept_pending_a_level).to be_nil
- expect(course.accept_a_level_equivalency).to be_nil
- expect(course.additional_a_level_equivalencies).to be_nil
- end
- end
- end
-end