From adbc010be7e3457a986fae93bcfead66a7aa0ef9 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 12:24:50 +0100 Subject: [PATCH 01/15] Remove personal qualities and other requirements Remove @show_other_requirements --- app/controllers/publish/courses_controller.rb | 2 -- app/helpers/publish_helper.rb | 4 ---- .../courses/_description_content.html.erb | 20 ------------------- 3 files changed, 26 deletions(-) diff --git a/app/controllers/publish/courses_controller.rb b/app/controllers/publish/courses_controller.rb index 0511301b72..7c3d06aa5b 100644 --- a/app/controllers/publish/courses_controller.rb +++ b/app/controllers/publish/courses_controller.rb @@ -18,8 +18,6 @@ def show authorize @course - @show_other_requirements = !provider.course_requirements_deprecated? - @errors = flash[:error_summary] flash.delete(:error_summary) end diff --git a/app/helpers/publish_helper.rb b/app/helpers/publish_helper.rb index c0250c21fc..238e49be82 100644 --- a/app/helpers/publish_helper.rb +++ b/app/helpers/publish_helper.rb @@ -40,8 +40,4 @@ def ruby_pants_options en_dash: '–' } end - - def render_if(condition, &) - yield if condition - end end diff --git a/app/views/publish/courses/_description_content.html.erb b/app/views/publish/courses/_description_content.html.erb index 34a03aadaf..dcdb4005cb 100644 --- a/app/views/publish/courses/_description_content.html.erb +++ b/app/views/publish/courses/_description_content.html.erb @@ -151,24 +151,4 @@ %w[accept_pending_gcse accept_gcse_equivalency accept_english_gcse_equivalency accept_maths_gcse_equivalency accept_science_gcse_equivalency additional_gcse_equivalencies], action_path: !course.is_withdrawn? && course.gcse_section_complete? ? gcses_pending_or_equivalency_tests_publish_provider_recruitment_cycle_course_path(@provider.provider_code, @provider.recruitment_cycle_year, course.course_code) : nil ) %> - - <% render_if(@show_other_requirements) do %> - <% enrichment_summary( - summary_list, - :course, - t("publish.providers.courses.description_content.personal_qualities_label"), - value_provided?(markdown(course.personal_qualities)), - %w[personal_qualities], - action_path: course.is_withdrawn? ? nil : "#{requirements_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code)}#personal-qualities" - ) %> - - <% enrichment_summary( - summary_list, - :course, - t("publish.providers.courses.description_content.other_requirements_label"), - value_provided?(markdown(course.other_requirements)), - %w[other_requirements], - action_path: course.is_withdrawn? ? nil : "#{requirements_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code)}#other-requirements" - ) %> - <% end %> <% end %> From 4dfbcb68bba34f747fdf0880541633ebf0c874d5 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 12:28:14 +0100 Subject: [PATCH 02/15] Remove CHANGES_INTRODUCED_IN_2022_CYCLE --- app/models/provider.rb | 6 ------ .../publish/courses/confirmation.html.erb | 21 ------------------- 2 files changed, 27 deletions(-) diff --git a/app/models/provider.rb b/app/models/provider.rb index 06bca68a76..f970703dcd 100644 --- a/app/models/provider.rb +++ b/app/models/provider.rb @@ -10,8 +10,6 @@ class Provider < ApplicationRecord include PgSearch::Model include VectorSearchable - CHANGES_INTRODUCED_IN_2022_CYCLE = 2022 - before_save :update_searchable, if: :accredited_provider? before_create :set_defaults @@ -381,10 +379,6 @@ def tda_active? recruitment_cycle_year.to_i > 2024 && FeatureService.enabled?(:teacher_degree_apprenticeship) end - def course_requirements_deprecated? - recruitment_cycle.after_2024? - end - private def accredited_provider_codes diff --git a/app/views/publish/courses/confirmation.html.erb b/app/views/publish/courses/confirmation.html.erb index f7323e9e05..54c8f5ee99 100644 --- a/app/views/publish/courses/confirmation.html.erb +++ b/app/views/publish/courses/confirmation.html.erb @@ -213,27 +213,6 @@ visually_hidden_text: "date course starts" ) %> <% end %> - - <% if course.gcse_subjects_required.any? && @provider.recruitment_cycle_year.to_i < Provider::CHANGES_INTRODUCED_IN_2022_CYCLE %> - <% summary_list.with_row(html_attributes: { data: { qa: "course__entry_requirements" } }) do |row| %> - <% row.with_key { "UCAS Apply: GCSE requirements for applicants" } %> - <% row.with_value do %> - <% course.gcse_subjects_required.each do |subject| %> - <%= render( - partial: "publish/courses/entry_requirements", - locals: { - gcse_subject: subject.titleize, - gcse_subject_code: course[subject] - } - ) %> - <% end %> - <% end %> - <% row.with_action({ - href: new_provider_recruitment_cycle_courses_entry_requirements_path(course.provider.provider_code, course.recruitment_cycle_year, params.to_unsafe_h.merge(goto_confirmation: true)), - visually_hidden_text: "entry requirements" - }) %> - <% end %> - <% end %> <% end %> <%= f.govuk_submit "Add course", data: { qa: "course__save" } %> From 709dff2de48c9bac1b0459fe169b7ed3715c011c Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 13:20:49 +0100 Subject: [PATCH 03/15] [1755] Remove CYCLE_REQUIREMENTS_FIELDS --- app/services/courses/copy.rb | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/app/services/courses/copy.rb b/app/services/courses/copy.rb index 48bf35d0a7..785a81e446 100644 --- a/app/services/courses/copy.rb +++ b/app/services/courses/copy.rb @@ -40,17 +40,6 @@ class Copy ['Salary details', 'salary_details'] ].freeze - POST_2022_CYCLE_REQUIREMENTS_FIELDS = [ - ['Personal qualities', 'personal_qualities'], - ['Other requirements', 'other_requirements'] - ].freeze - - PRE_2022_CYCLE_REQUIREMENTS_FIELDS = [ - ['Qualifications needed', 'required_qualifications'], - ['Personal qualities', 'personal_qualities'], - ['Other requirements', 'other_requirements'] - ].freeze - # TODO: This is to be utilised when we add these to a course form VISA_FIELDS = [ ['Can sponsor skilled worker visa', 'can_sponsor_skilled_worker_visa'], From 23ba5d2de296dd327a023cbbf22311697bb30532 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 13:21:30 +0100 Subject: [PATCH 04/15] [1755] Remove controller, form, routes and view --- .../courses/requirements_controller.rb | 58 ----------------- app/forms/publish/course_requirement_form.rb | 23 ------- .../courses/requirements/edit.html.erb | 64 ------------------- config/routes/publish.rb | 8 --- 4 files changed, 153 deletions(-) delete mode 100644 app/controllers/publish/courses/requirements_controller.rb delete mode 100644 app/forms/publish/course_requirement_form.rb delete mode 100644 app/views/publish/courses/requirements/edit.html.erb diff --git a/app/controllers/publish/courses/requirements_controller.rb b/app/controllers/publish/courses/requirements_controller.rb deleted file mode 100644 index 56ce56bd80..0000000000 --- a/app/controllers/publish/courses/requirements_controller.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -module Publish - module Courses - class RequirementsController < PublishController - include CopyCourseContent - decorates_assigned :source_course - - def edit - authorize(provider) - - @course_requirement_form = CourseRequirementForm.new(course_enrichment) - @copied_fields = if @course.recruitment_cycle_year.to_i >= Provider::CHANGES_INTRODUCED_IN_2022_CYCLE - copy_content_check(::Courses::Copy::POST_2022_CYCLE_REQUIREMENTS_FIELDS) - else - copy_content_check(::Courses::Copy::PRE_2022_CYCLE_REQUIREMENTS_FIELDS) - end - @copied_fields_values = copied_fields_values if @copied_fields.present? - end - - def update - authorize(provider) - - @course_requirement_form = CourseRequirementForm.new(course_enrichment, params: course_requirement_params) - - if @course_requirement_form.save! - course_updated_message('Personal qualities and other requirements') - - redirect_to publish_provider_recruitment_cycle_course_path( - provider.provider_code, - recruitment_cycle.year, - course.course_code - ) - else - render :edit - end - end - - private - - def course - @course ||= CourseDecorator.new(provider.courses.find_by!(course_code: params[:code])) - end - - def course_requirement_params - params - .require(:publish_course_requirement_form) - .permit( - CourseRequirementForm::FIELDS - ) - end - - def course_enrichment - @course_enrichment ||= course.enrichments.find_or_initialize_draft - end - end - end -end diff --git a/app/forms/publish/course_requirement_form.rb b/app/forms/publish/course_requirement_form.rb deleted file mode 100644 index 63ebe8fad1..0000000000 --- a/app/forms/publish/course_requirement_form.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module Publish - class CourseRequirementForm < BaseModelForm - alias course_enrichment model - - FIELDS = %i[ - personal_qualities - other_requirements - ].freeze - - attr_accessor(*FIELDS) - - validates :personal_qualities, words_count: { maximum: 100, message: :too_long } - validates :other_requirements, words_count: { maximum: 100, message: :too_long } - - private - - def compute_fields - course_enrichment.attributes.symbolize_keys.slice(*FIELDS).merge(new_attributes) - end - end -end diff --git a/app/views/publish/courses/requirements/edit.html.erb b/app/views/publish/courses/requirements/edit.html.erb deleted file mode 100644 index c33caff5ae..0000000000 --- a/app/views/publish/courses/requirements/edit.html.erb +++ /dev/null @@ -1,64 +0,0 @@ -<% page_title = "Personal qualities and other requirements" %> - -<% content_for :page_title, title_with_error_prefix("#{page_title} – #{@course.name_and_code}", @course_requirement_form.errors.any?) %> - -<% content_for :before_content do %> - <%= govuk_back_link_to(publish_provider_recruitment_cycle_course_path(@provider.provider_code, @course.recruitment_cycle_year, @course.course_code)) %> -<% end %> - -<% if params[:copy_from].present? %> - <%= render partial: "publish/courses/copy_content_warning", locals: { copied_fields: @copied_fields } %> -<% end %> - -
-
- <%= form_with( - model: @course_requirement_form, - url: requirements_publish_provider_recruitment_cycle_course_path(@provider.provider_code, @course.recruitment_cycle_year, @course.course_code), - data: { qa: "enrichment-form", module: "form-check-leave" }, - method: :patch, - local: true - ) do |f| %> - - <%= f.govuk_error_summary %> - -

- <%= @course.name_and_code %> - <%= page_title %> -

- - <%= f.govuk_text_area :personal_qualities, - form_group: { id: "personal-qualities" }, - value: @copied_fields_values&.dig("personal_qualities") || @course.personal_qualities, - label: { text: "Personal qualities (optional)", size: "m" }, - hint: { text: "Tell applicants about the skills, motivation and experience you’re looking for (for example, experience of working with children, a genuine passion for the subject or a talent for public speaking)." }, - max_words: 100, - rows: 10 %> - -
- - <%= f.govuk_text_area :other_requirements, - form_group: { id: "other-requirements" }, - value: @copied_fields_values&.dig("other_requirements") || @course.other_requirements, - label: { text: "Other requirements (optional)", size: "m" }, - hint: { text: "If applicants need any non-academic qualifications or documents, list them here (such as criminal record checks or relevant work experience)." }, - max_words: 100, - rows: 10 %> - - <%= f.govuk_submit "Update #{page_title.downcase}" %> - <% 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/config/routes/publish.rb b/config/routes/publish.rb index 9bfa99e245..1ac05a2ed1 100644 --- a/config/routes/publish.rb +++ b/config/routes/publish.rb @@ -178,14 +178,6 @@ get '/school-placements', on: :member, to: 'courses/school_placements#edit' patch '/school-placements', on: :member, to: 'courses/school_placements#update' get '/placements', on: :member, to: 'courses/school_placements#index', as: :placements - - # This feature is deprecated and will be removed after the beginning of - # 2025 recruitment cycle. - scope constraints: { recruitment_cycle_year: /2024/ } do - get '/requirements', on: :member, to: 'courses/requirements#edit' - patch '/requirements', on: :member, to: 'courses/requirements#update' - end - get '/length', on: :member, to: 'courses/length#edit' patch '/length', on: :member, to: 'courses/length#update' get '/fees-and-financial-support', on: :member, to: 'courses/fees_and_financial_support#edit' From c6e4163baa2984a0eaf4c654136e53e558d90153 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 13:22:03 +0100 Subject: [PATCH 05/15] [1755] Remove attributes from view preview --- .../find/courses/entry_requirements_component/view_preview.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/components/find/courses/entry_requirements_component/view_preview.rb b/spec/components/find/courses/entry_requirements_component/view_preview.rb index 87acf996b0..3b9c4c6ebc 100644 --- a/spec/components/find/courses/entry_requirements_component/view_preview.rb +++ b/spec/components/find/courses/entry_requirements_component/view_preview.rb @@ -71,8 +71,6 @@ def mock_course_attributes accept_maths_gcse_equivalency: true, accept_science_gcse_equivalency: true, additional_gcse_equivalencies: 'much much more', - personal_qualities: 'Personal Qualities Text Goes Here', - other_requirements: 'Other Requirements Text Goes Here', computed_subject_name_or_names: 'Biology', subjects: [Subject.new(subject_name: 'foo', subject_code: 'sc')] } end @@ -83,7 +81,7 @@ def mock_course class FakeCourse include ActiveModel::Model - attr_accessor(:degree_grade, :degree_subject_requirements, :level, :name, :gcse_grade_required, :accept_pending_gcse, :accept_gcse_equivalency, :accept_english_gcse_equivalency, :accept_maths_gcse_equivalency, :accept_science_gcse_equivalency, :additional_gcse_equivalencies, :personal_qualities, :other_requirements, :computed_subject_name_or_names, :campaign_name, :subjects) + attr_accessor(:degree_grade, :degree_subject_requirements, :level, :name, :gcse_grade_required, :accept_pending_gcse, :accept_gcse_equivalency, :accept_english_gcse_equivalency, :accept_maths_gcse_equivalency, :accept_science_gcse_equivalency, :additional_gcse_equivalencies, :computed_subject_name_or_names, :campaign_name, :subjects) def enrichment_attribute(params) send(params) From 30ae40fc593cae16a9c865ff25821c07b7a50799 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 13:22:37 +0100 Subject: [PATCH 06/15] [1755] Remove tests and page object --- .../editing_course_requirements_2024_spec.rb | 151 ------------------ .../editing_course_requirements_2025_spec.rb | 55 ------- spec/support/page_objects/find/course_show.rb | 2 - .../publish/course_requirement_edit.rb | 27 ---- 4 files changed, 235 deletions(-) delete mode 100644 spec/features/publish/courses/editing_course_requirements_2024_spec.rb delete mode 100644 spec/features/publish/courses/editing_course_requirements_2025_spec.rb delete mode 100644 spec/support/page_objects/publish/course_requirement_edit.rb diff --git a/spec/features/publish/courses/editing_course_requirements_2024_spec.rb b/spec/features/publish/courses/editing_course_requirements_2024_spec.rb deleted file mode 100644 index 0fa1b6338a..0000000000 --- a/spec/features/publish/courses/editing_course_requirements_2024_spec.rb +++ /dev/null @@ -1,151 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -feature 'Editing course requirements', { can_edit_current_and_next_cycles: false } do - before do - allow(Settings).to receive(:current_recruitment_cycle_year).and_return(2024) - - given_i_am_authenticated_as_a_provider_user - and_there_is_a_course_i_want_to_edit - when_i_visit_the_course_requirements_page - end - - scenario 'i can update the requirements of the course' do - then_i_should_see_the_reuse_content - and_i_update_the_requirements - and_i_submit - then_i_should_see_a_success_message - and_the_course_requirements_are_updated - end - - context 'copying content from another course' do - let!(:course_two) do - create( - :course, - provider:, - name: 'Biology', - enrichments: [course2_enrichment] - ) - end - - let!(:course3) do - create(:course, - provider:, - name: 'Biology', - enrichments: [course3_enrichment]) - end - - let(:course2_enrichment) do - build(:course_enrichment, - personal_qualities: 'Test personal qualities', - other_requirements: 'Test other requirements') - end - - let(:course3_enrichment) do - build(:course_enrichment, - personal_qualities: 'Test course 3', - other_requirements: '') - end - - scenario 'all fields get copied if all are present' do - when_i_visit_the_course_requirements_page - publish_course_requirement_edit_page.copy_content.copy(course_two) - - [ - 'Your changes are not yet saved', - 'Personal qualities', - 'Other requirements' - ].each do |name| - expect(publish_course_requirement_edit_page.copy_content_warning).to have_content(name) - end - - expect(publish_course_requirement_edit_page.personal_qualities.value).to eq(course2_enrichment.personal_qualities) - expect(publish_course_requirement_edit_page.other_requirements.value).to eq(course2_enrichment.other_requirements) - end - - scenario 'missing fields do not get copied' do - publish_course_requirement_edit_page.load( - provider_code: provider.provider_code, recruitment_cycle_year: provider.recruitment_cycle_year, course_code: course_two.course_code - ) - publish_course_requirement_edit_page.copy_content.copy(course3) - - [ - 'Your changes are not yet saved', - 'Personal qualities' - ].each do |name| - expect(publish_course_requirement_edit_page.copy_content_warning).to have_content(name) - end - - [ - 'other requirements' - ].each do |name| - expect(publish_course_requirement_edit_page.copy_content_warning).to have_no_content(name) - end - - expect(publish_course_requirement_edit_page.personal_qualities.value).to eq(course3_enrichment.personal_qualities) - expect(publish_course_requirement_edit_page.other_requirements.value).to eq(course2_enrichment.other_requirements) - end - end - - scenario 'updating with invalid data' do - and_i_submit_with_invalid_data - then_i_should_see_an_error_message - end - - def then_i_should_see_the_reuse_content - expect(publish_course_requirement_edit_page).to have_use_content - end - - def given_i_am_authenticated_as_a_provider_user - given_i_am_authenticated(user: create(:user, :with_provider)) - end - - def and_there_is_a_course_i_want_to_edit - given_a_course_exists(enrichments: [build(:course_enrichment, :published)]) - end - - def when_i_visit_the_course_requirements_page - publish_course_requirement_edit_page.load( - provider_code: provider.provider_code, recruitment_cycle_year: provider.recruitment_cycle_year, course_code: course.course_code - ) - end - - def and_i_update_the_requirements - @personal_qualities = 'This is a new requirement' - @other_requirements = 'This is another new requirement' - - publish_course_requirement_edit_page.personal_qualities.set(@personal_qualities) - publish_course_requirement_edit_page.other_requirements.set(@other_requirements) - end - - def and_i_submit_with_invalid_data - publish_course_requirement_edit_page.personal_qualities.set(Faker::Lorem.sentence(word_count: 101)) - and_i_submit - end - - def and_i_submit - publish_course_requirement_edit_page.submit.click - end - - def then_i_should_see_a_success_message - expect(page).to have_content(I18n.t('success.saved', value: 'Personal qualities and other requirements')) - end - - def and_the_course_requirements_are_updated - enrichment = course.reload.enrichments.find_or_initialize_draft - - expect(enrichment.personal_qualities).to eq(@personal_qualities) - expect(enrichment.other_requirements).to eq(@other_requirements) - end - - def then_i_should_see_an_error_message - expect(publish_course_requirement_edit_page.error_messages).to include( - I18n.t('activemodel.errors.models.publish/course_requirement_form.attributes.personal_qualities.too_long') - ) - end - - def provider - @current_user.providers.first - end -end diff --git a/spec/features/publish/courses/editing_course_requirements_2025_spec.rb b/spec/features/publish/courses/editing_course_requirements_2025_spec.rb deleted file mode 100644 index 58a6c72d6c..0000000000 --- a/spec/features/publish/courses/editing_course_requirements_2025_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -feature 'Editing course deprecated requirements in 2025', { can_edit_current_and_next_cycles: false } do - before do - allow(Settings).to receive(:current_recruitment_cycle_year).and_return(2025) - given_i_am_authenticated_as_a_provider_user - and_there_is_a_course_i_want_to_edit - provider - end - - scenario 'there are no links to the course requirements page' do - when_i_visit_the_course_details_page - then_there_is_no_link_to_course_requirements - end - - scenario 'I can not visit the other requirements page' do - expect do - visit requirements_publish_provider_recruitment_cycle_course_path(@course.provider.provider_code, 2025, @course.course_code) - end.to raise_error(ActionController::UrlGenerationError) - end - - def given_i_am_authenticated_as_a_provider_user - given_i_am_authenticated(user: create(:user, :with_provider)) - end - - def and_there_is_a_course_i_want_to_edit - given_a_course_exists(enrichments: [build(:course_enrichment, :published)]) - end - - def then_there_is_no_link_to_course_requirements - expect(page).to have_no_content('Other requirements') - end - - def when_i_visit_the_course_details_page - publish_provider_courses_show_page.load( - provider_code: provider.provider_code, recruitment_cycle_year: provider.recruitment_cycle_year, course_code: course.course_code - ) - end - - def when_i_visit_the_course_requirements_page - publish_course_requirement_edit_page.load( - provider_code: provider.provider_code, recruitment_cycle_year: provider.recruitment_cycle_year, course_code: course.course_code - ) - end - - def then_i_should_see_a_success_message - expect(page).to have_content(I18n.t('success.saved', value: 'Personal qualities and other requirements')) - end - - def provider - @current_user.providers.first - end -end diff --git a/spec/support/page_objects/find/course_show.rb b/spec/support/page_objects/find/course_show.rb index c1765b7ae0..741ec57dfa 100644 --- a/spec/support/page_objects/find/course_show.rb +++ b/spec/support/page_objects/find/course_show.rb @@ -24,8 +24,6 @@ class CourseShow < PageObjects::Base element :early_career_payment_details, '[data-qa=course__early_career_payment_details]' element :financial_support_details, '[data-qa=course__financial_support_details]' element :required_qualifications, '[data-qa=course__required_qualifications]' - element :personal_qualities, '[data-qa=course__personal_qualities]' - element :other_requirements, '[data-qa=course__other_requirements]' element :train_with_us, '[data-qa=course__about_provider]' element :about_accrediting_provider, '[data-qa=course__about_accrediting_provider]' element :international_students, '[data-qa=course__international_students]' diff --git a/spec/support/page_objects/publish/course_requirement_edit.rb b/spec/support/page_objects/publish/course_requirement_edit.rb deleted file mode 100644 index 0e7495e14a..0000000000 --- a/spec/support/page_objects/publish/course_requirement_edit.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -require_relative '../sections/error_link' -require_relative '../sections/copy_content' - -module PageObjects - module Publish - class CourseRequirementEdit < PageObjects::Base - set_url '/publish/organisations/{provider_code}/{recruitment_cycle_year}/courses/{course_code}/requirements' - - sections :errors, Sections::ErrorLink, '.govuk-error-summary__list li>a' - - element :copy_content_warning, '[data-qa="copy-course-warning"]' - element :personal_qualities, '#publish-course-requirement-form-personal-qualities-field' - element :other_requirements, '#publish-course-requirement-form-other-requirements-field' - element :use_content, '[data-qa="course__use_content"]' - - section :copy_content, Sections::CopyContent - - element :submit, 'button.govuk-button[type="submit"]' - - def error_messages - errors.map(&:text) - end - end - end -end From b1551995c37d4e03f849a4dc52a240c0f7efbfcf Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 13:31:46 +0100 Subject: [PATCH 07/15] [1755] Remove form translations --- config/locales/en.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 686f9aa61c..45a81e152b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1125,15 +1125,6 @@ en: attributes: study_site_ids: blank: "Add at least one study site" - publish/course_requirement_form: - attributes: - required_qualifications: - blank: "Enter details about the qualifications needed" - too_long: "Reduce the word count for required qualifications" - personal_qualities: - too_long: "Reduce the word count for personal qualities" - other_requirements: - too_long: "Reduce the word count for other requirements" publish/course_study_mode_form: attributes: study_mode: From c8754479009c41250700ef9a3b4c3f82132663da Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 13:46:16 +0100 Subject: [PATCH 08/15] [1755] Delete redundant specs This is all tested in the file which is now called viewing_a_course_spec.rb --- .../find/search/viewing_a_course_spec.rb | 2 - .../publish/viewing_a_course_2025_spec.rb | 317 ------------------ ..._2024_spec.rb => viewing_a_course_spec.rb} | 15 +- 3 files changed, 1 insertion(+), 333 deletions(-) delete mode 100644 spec/features/publish/viewing_a_course_2025_spec.rb rename spec/features/publish/{viewing_a_course_2024_spec.rb => viewing_a_course_spec.rb} (96%) diff --git a/spec/features/find/search/viewing_a_course_spec.rb b/spec/features/find/search/viewing_a_course_spec.rb index da4b0692f2..6c1828f6ef 100644 --- a/spec/features/find/search/viewing_a_course_spec.rb +++ b/spec/features/find/search/viewing_a_course_spec.rb @@ -127,8 +127,6 @@ def given_there_is_a_findable_course fee_uk_eu: '9250', fee_international: '9250', fee_details: 'Optional fee details', - personal_qualities: 'We are looking for ambitious trainee teachers who are passionate.', - other_requirements: 'You will need three years of prior work experience, but not necessarily in an educational context.', interview_process: 'Some helpful guidance about the interview process', how_school_placements_work: 'Some info about how placements work', about_course: 'This is a course', diff --git a/spec/features/publish/viewing_a_course_2025_spec.rb b/spec/features/publish/viewing_a_course_2025_spec.rb deleted file mode 100644 index e43de87d8e..0000000000 --- a/spec/features/publish/viewing_a_course_2025_spec.rb +++ /dev/null @@ -1,317 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -feature 'Course show 2025', { can_edit_current_and_next_cycles: false } do - include ActiveSupport::NumberHelper - - before do - allow(Settings).to receive(:current_recruitment_cycle_year).and_return(2025) - create(:recruitment_cycle) - end - - scenario 'i can not see other personal qualities or other requirements' do - given_i_am_authenticated_as_a_provider_user(course: build(:course)) - and_i_visit_the_course_page - and_i_do_not_see_personal_qualities - and_i_see_requirements_and_eligibility - and_i_do_not_see_other_requirements - end - - scenario 'i can view the course basic details' do - given_i_am_authenticated_as_a_provider_user(course: build(:course)) - when_i_visit_the_course_page - and_i_click_on_basic_details - then_i_see_the_course_basic_details - end - - describe 'with a fee paying course' do - context 'bursaries and scholarships is announced' do - before do - FeatureFlag.activate(:bursaries_and_scholarships_announced) - end - - scenario 'i can view a fee course' do - given_i_am_authenticated_as_a_provider_user(course: course_with_financial_incentive) - when_i_visit_the_course_page - then_i_see_the_description_of_the_fee_course - and_i_see_the_course_financial_incentives - and_i_see_the_course_button_panel - end - end - - context 'bursaries and scholarships is not announced' do - scenario 'i can view a fee course' do - given_i_am_authenticated_as_a_provider_user(course: course_with_financial_incentive) - when_i_visit_the_course_page - then_i_see_the_description_of_the_fee_course - and_i_see_the_course_has_no_financial_incentives_information - and_i_see_the_course_button_panel - end - end - end - - describe 'with a salary paying course' do - scenario 'i can view a salary course' do - given_i_am_authenticated_as_a_provider_user(course: build(:course, enrichments: [course_enrichment], funding_type: 'salary')) - when_i_visit_the_course_page - then_i_see_the_description_of_the_salary_course - and_i_see_the_course_as('Closed') - and_i_see_the_course_button_panel - end - end - - describe 'with a published and running course' do - scenario 'i can view the published partial' do - given_i_am_authenticated_as_a_provider_user(course: build(:course, enrichments: [course_enrichment], application_status: 'open', funding_type: 'salary', site_statuses: [build(:site_status, :findable)])) - when_i_visit_the_course_page - then_i_see_the_description_of_the_salary_course - and_i_see_the_course_as('Open') - and_i_see_the_course_button_panel - and_i_see_the_published_partial - and_i_do_not_see_the_rollover_button - end - end - - describe 'with a published with unpublished changes course' do - scenario 'i can view the unpublished partial' do - given_i_am_authenticated_as_a_provider_user(course: build(:course, enrichments: [course_enrichment_unpublished_changes], funding_type: 'salary')) - when_i_visit_the_course_page - then_i_see_the_description_of_the_unpublished_changes_course - and_i_see_the_course_button_panel - and_i_see_the_unpublished_with_changes_partial - and_i_do_not_see_the_rollover_button - end - end - - describe 'with a withdrawn course' do - scenario 'i can view the withdrawn course' do - given_i_am_authenticated_as_a_provider_user(course: build(:course, enrichments: [course_enrichment_withdrawn])) - when_i_visit_the_course_page - then_i_see_the_course_button_panel - and_i_see_the_course_withdrawn_date_and_preview_link - and_there_is_no_change_links - end - end - - private - - def and_there_is_no_change_links - expect(page.find_all('.govuk-summary-list__actions a').any?).to be(false) - end - - def and_i_see_the_course_button_panel - expect(publish_provider_courses_show_page).to have_course_button_panel - end - - def and_i_do_not_see_the_rollover_button - publish_provider_courses_show_page.course_button_panel.within do |course_button_panel| - expect(course_button_panel).not_to have_rollover_button - end - end - - alias_method :then_i_see_the_course_button_panel, :and_i_see_the_course_button_panel - - def and_i_see_the_unpublished_with_changes_partial - publish_provider_courses_show_page.course_button_panel.within do |course_button_panel| - expect(course_button_panel).to have_publish_button - expect(course_button_panel).to have_withdraw_link - expect(course_button_panel).to have_last_publish_date - end - end - - def and_i_see_the_published_partial - publish_provider_courses_show_page.course_button_panel.within do |course_button_panel| - expect(course_button_panel).to have_view_on_find - expect(course_button_panel).to have_withdraw_link - expect(course_button_panel).to have_last_publish_date - expect(course_button_panel).not_to have_delete_link - end - end - - def and_i_click_on_basic_details - publish_provider_courses_show_page.basic_details_link.click - end - - def then_i_see_the_course_basic_details - expect(page).to have_current_path("/publish/organisations/#{provider.provider_code}/#{provider.recruitment_cycle_year}/courses/#{course.course_code}/details") - end - - def and_i_see_the_course_withdrawn_date_and_preview_link - publish_provider_courses_show_page.course_button_panel.within do |course_button_panel| - expect(course_button_panel).to have_withdrawn_date - expect(course_button_panel).to have_preview_link - end - end - - def course_enrichment - @course_enrichment ||= build(:course_enrichment, :published, course_length: :TwoYears, fee_uk_eu: 9250, fee_international: 14_000) - end - - def financial_incentive - @financial_incentive ||= build(:financial_incentive, bursary_amount: 10_000) - end - - def course_enrichment_unpublished_changes - @course_enrichment_unpublished_changes ||= build(:course_enrichment, :subsequent_draft, course_length: :TwoYears, fee_uk_eu: 9250, fee_international: 14_000) - end - - def course_enrichment_withdrawn - @course_enrichment_withdrawn ||= build(:course_enrichment, :withdrawn) - end - - def given_i_am_authenticated_as_a_provider_user(course:) - given_i_am_authenticated( - user: create( - :user, - providers: [ - create(:provider, sites: [build(:site)], courses: [course]) - ] - ) - ) - end - - def when_i_visit_the_course_page - publish_provider_courses_show_page.load( - provider_code: provider.provider_code, recruitment_cycle_year: provider.recruitment_cycle_year, course_code: course.course_code - ) - end - - def then_i_see_the_description_of_the_unpublished_changes_course - expect(publish_provider_courses_show_page.about_course).to have_content( - course_enrichment_unpublished_changes.about_course - ) - end - - def and_i_see_the_course_financial_incentives - expect(publish_provider_courses_show_page.financial_incentives).to have_content(number_to_currency(10_000)) - end - - def and_i_see_the_course_has_no_financial_incentives_information - expect(publish_provider_courses_show_page.financial_incentives).to have_content('Information not yet available') - end - - def then_i_see_the_description_of_the_fee_course - expect(publish_provider_courses_show_page.title).to have_content( - "#{course.name} (#{course.course_code})" - ) - expect(publish_provider_courses_show_page.about_course).to have_content( - course_enrichment.about_course - ) - expect(publish_provider_courses_show_page.interview_process).to have_content( - course_enrichment.interview_process - ) - expect(publish_provider_courses_show_page.how_school_placements_work).to have_content( - course_enrichment.how_school_placements_work - ) - expect(publish_provider_courses_show_page.course_length).to have_content( - 'Up to 2 years' - ) - expect(publish_provider_courses_show_page.fee_uk_eu).to have_content( - '£9,250' - ) - expect(publish_provider_courses_show_page.fee_international).to have_content( - '£14,000' - ) - expect(publish_provider_courses_show_page.fee_details).to have_content( - course_enrichment.fee_details - ) - - expect(publish_provider_courses_show_page).not_to have_salary_details - - expect(publish_provider_courses_show_page).to have_degree - expect(publish_provider_courses_show_page).to have_gcse - - expect(publish_provider_courses_show_page).to have_no_content( - '[data-qa=course__personal_qualities]' - ) - expect(publish_provider_courses_show_page).to have_no_content( - '[data-qa=course__other_requirements]' - ) - end - - def then_i_see_the_description_of_the_salary_course - expect(publish_provider_courses_show_page.title).to have_content( - "#{course.name} (#{course.course_code})" - ) - - expect(publish_provider_courses_show_page.about_course).to have_content( - course_enrichment.about_course - ) - expect(publish_provider_courses_show_page.interview_process).to have_content( - course_enrichment.interview_process - ) - expect(publish_provider_courses_show_page.how_school_placements_work).to have_content( - course_enrichment.how_school_placements_work - ) - expect(publish_provider_courses_show_page.course_length).to have_content( - 'Up to 2 years' - ) - expect(publish_provider_courses_show_page).not_to have_fee_uk_eu - - expect(publish_provider_courses_show_page).not_to have_fee_international - - expect(publish_provider_courses_show_page).not_to have_fee_details - expect(publish_provider_courses_show_page.salary_details).to have_content( - course_enrichment.salary_details - ) - expect(publish_provider_courses_show_page).to have_degree - expect(publish_provider_courses_show_page).to have_gcse - expect(publish_provider_courses_show_page).to have_no_content( - '[data-qa=course__personal_qualities]' - ) - expect(publish_provider_courses_show_page).to have_no_content( - '[data-qa=course__other_requirements]' - ) - end - - def and_i_see_the_course_as(status_tag) - expect(publish_provider_courses_show_page.content_status).to have_content(status_tag) - end - - def provider - @current_user.providers.first - end - - def course - provider.courses.first - end - - def course_with_financial_incentive - build( - :course, - :secondary, - enrichments: [course_enrichment], - funding_type: 'fee', - subjects: [build(:secondary_subject, bursary_amount: 10_000)] - ) - end - - private - - def and_i_see_requirements_and_eligibility - expect(page).to have_content('Requirements and eligibility') - end - - def and_i_do_not_see_personal_qualities - expect(page).to have_no_content('Personal qualities') - end - - def and_i_do_not_see_other_requirements - expect(page).to have_no_content('Other requirements') - end - - def provider - @current_user.providers.first - end - - def course - provider.courses.first - end - - def and_i_visit_the_course_page - publish_provider_courses_show_page.load( - provider_code: provider.provider_code, recruitment_cycle_year: provider.recruitment_cycle_year, course_code: course.course_code - ) - end -end diff --git a/spec/features/publish/viewing_a_course_2024_spec.rb b/spec/features/publish/viewing_a_course_spec.rb similarity index 96% rename from spec/features/publish/viewing_a_course_2024_spec.rb rename to spec/features/publish/viewing_a_course_spec.rb index 940c088837..d904afcabe 100644 --- a/spec/features/publish/viewing_a_course_2024_spec.rb +++ b/spec/features/publish/viewing_a_course_spec.rb @@ -6,7 +6,7 @@ include ActiveSupport::NumberHelper scenario 'i can view the course basic details' do - allow(Settings).to receive(:current_recruitment_cycle_year).and_return(2024) + # allow(Settings).to receive(:current_recruitment_cycle_year).and_return(2024) given_i_am_authenticated_as_a_provider_user(course: build(:course)) when_i_visit_the_course_page and_i_click_on_basic_details @@ -352,13 +352,6 @@ def then_i_should_see_the_description_of_the_fee_course expect(publish_provider_courses_show_page).to have_degree expect(publish_provider_courses_show_page).to have_gcse - - expect(publish_provider_courses_show_page.personal_qualities).to have_content( - course_enrichment.personal_qualities - ) - expect(publish_provider_courses_show_page.other_requirements).to have_content( - course_enrichment.other_requirements - ) end def then_i_should_see_the_description_of_the_salary_course @@ -388,12 +381,6 @@ def then_i_should_see_the_description_of_the_salary_course ) expect(publish_provider_courses_show_page).to have_degree expect(publish_provider_courses_show_page).to have_gcse - expect(publish_provider_courses_show_page.personal_qualities).to have_content( - course_enrichment.personal_qualities - ) - expect(publish_provider_courses_show_page.other_requirements).to have_content( - course_enrichment.other_requirements - ) end def and_i_should_see_the_course_as(status_tag) From 65867ed3970d6604467d5f29e38c29ebb4923ad7 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 13:50:43 +0100 Subject: [PATCH 09/15] [1755] Remove elements for page objects --- spec/support/page_objects/publish/course_preview.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/support/page_objects/publish/course_preview.rb b/spec/support/page_objects/publish/course_preview.rb index ce0a64a02b..9fb4565128 100644 --- a/spec/support/page_objects/publish/course_preview.rb +++ b/spec/support/page_objects/publish/course_preview.rb @@ -24,8 +24,6 @@ class CoursePreview < PageObjects::Base element :early_career_payment_details, '[data-qa=course__early_career_payment_details]' element :financial_support_details, '[data-qa=course__financial_support_details]' element :required_qualifications, '[data-qa=course__required_qualifications]' - element :personal_qualities, '[data-qa=course__personal_qualities]' - element :other_requirements, '[data-qa=course__other_requirements]' element :train_with_us, '[data-qa=course__about_provider]' element :about_accrediting_provider, '[data-qa=course__about_accrediting_provider]' element :train_with_disability, '[data-qa=course__train_with_disabilities]' From e282d02d27c9d8c4a09648aa70057ff031609962 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 13:55:48 +0100 Subject: [PATCH 10/15] [1755] Remove unused translations --- config/locales/en.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 45a81e152b..4c4d13473e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -434,8 +434,6 @@ en: requirements_heading: Requirements and eligibility degree_label: Degree gcse_label: GCSEs - personal_qualities_label: Personal qualities - other_requirements_label: Other requirements enter_a_levels: Enter A levels and equivalency test requirements a_levels_heading: A levels and equivalency tests a_levels_label: A levels From ff4c896d7d8e6d1152a2e868cfaade03588970e7 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 13:56:19 +0100 Subject: [PATCH 11/15] [1755] Remove factories --- spec/factories/course_enrichments.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/factories/course_enrichments.rb b/spec/factories/course_enrichments.rb index 775f2d7c26..bf025d8236 100644 --- a/spec/factories/course_enrichments.rb +++ b/spec/factories/course_enrichments.rb @@ -53,8 +53,6 @@ end how_school_placements_work { Faker::Lorem.sentence } interview_process { Faker::Lorem.sentence } - other_requirements { Faker::Lorem.sentence } - personal_qualities { Faker::Lorem.sentence } required_qualifications { Faker::Educator.degree } # Technically, salary_details should align with whether the course is # salaried or not. Maybe worth implementing this somehow at some point. From 16b35abf65603548c36abf9b417c106375a910e3 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 14:13:12 +0100 Subject: [PATCH 12/15] [1755] Remove page object attributes for personal qualities --- spec/support/page_objects/publish/provider_courses_show.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/support/page_objects/publish/provider_courses_show.rb b/spec/support/page_objects/publish/provider_courses_show.rb index 2692fe35dc..4f845bcfa3 100644 --- a/spec/support/page_objects/publish/provider_courses_show.rb +++ b/spec/support/page_objects/publish/provider_courses_show.rb @@ -24,8 +24,6 @@ class ProviderCoursesShow < PageObjects::Base section :degree, Sections::SummaryList, '[data-qa="enrichment__degree_grade"]' section :gcse, Sections::SummaryList, '[data-qa="enrichment__accept_pending_gcse"]' section :a_level, Sections::SummaryList, '[data-qa="enrichment__a_level_requirements"]' - section :personal_qualities, Sections::SummaryList, '[data-qa="enrichment__personal_qualities"]' - section :other_requirements, Sections::SummaryList, '[data-qa="enrichment__other_requirements"]' section :course_button_panel, Sections::CourseButtonPanel, '[data-qa="course__button_panel"]' element :description_link, 'a.app-secondary-navigation__link', text: 'Description' From 9a9981f9b654d459eab930069be23ae7e57414e8 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 15:14:27 +0100 Subject: [PATCH 13/15] [1755] Put back page object --- .../publish/course_requirement_edit.rb | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 spec/support/page_objects/publish/course_requirement_edit.rb diff --git a/spec/support/page_objects/publish/course_requirement_edit.rb b/spec/support/page_objects/publish/course_requirement_edit.rb new file mode 100644 index 0000000000..0e7495e14a --- /dev/null +++ b/spec/support/page_objects/publish/course_requirement_edit.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require_relative '../sections/error_link' +require_relative '../sections/copy_content' + +module PageObjects + module Publish + class CourseRequirementEdit < PageObjects::Base + set_url '/publish/organisations/{provider_code}/{recruitment_cycle_year}/courses/{course_code}/requirements' + + sections :errors, Sections::ErrorLink, '.govuk-error-summary__list li>a' + + element :copy_content_warning, '[data-qa="copy-course-warning"]' + element :personal_qualities, '#publish-course-requirement-form-personal-qualities-field' + element :other_requirements, '#publish-course-requirement-form-other-requirements-field' + element :use_content, '[data-qa="course__use_content"]' + + section :copy_content, Sections::CopyContent + + element :submit, 'button.govuk-button[type="submit"]' + + def error_messages + errors.map(&:text) + end + end + end +end From 39bb4dea014ef62019e90817e0369defaab44da9 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 15:15:55 +0100 Subject: [PATCH 14/15] [1755] Remove unused page object attributes --- spec/support/page_objects/publish/course_requirement_edit.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/support/page_objects/publish/course_requirement_edit.rb b/spec/support/page_objects/publish/course_requirement_edit.rb index 0e7495e14a..393bd3a904 100644 --- a/spec/support/page_objects/publish/course_requirement_edit.rb +++ b/spec/support/page_objects/publish/course_requirement_edit.rb @@ -11,8 +11,6 @@ class CourseRequirementEdit < PageObjects::Base sections :errors, Sections::ErrorLink, '.govuk-error-summary__list li>a' element :copy_content_warning, '[data-qa="copy-course-warning"]' - element :personal_qualities, '#publish-course-requirement-form-personal-qualities-field' - element :other_requirements, '#publish-course-requirement-form-other-requirements-field' element :use_content, '[data-qa="course__use_content"]' section :copy_content, Sections::CopyContent From ed3ef77a96338933ab3fb05f269f7901e80709f0 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Wed, 10 Jul 2024 15:55:49 +0100 Subject: [PATCH 15/15] [1755] Remove comment --- spec/features/publish/viewing_a_course_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/publish/viewing_a_course_spec.rb b/spec/features/publish/viewing_a_course_spec.rb index d904afcabe..8223d58991 100644 --- a/spec/features/publish/viewing_a_course_spec.rb +++ b/spec/features/publish/viewing_a_course_spec.rb @@ -6,7 +6,6 @@ include ActiveSupport::NumberHelper scenario 'i can view the course basic details' do - # allow(Settings).to receive(:current_recruitment_cycle_year).and_return(2024) given_i_am_authenticated_as_a_provider_user(course: build(:course)) when_i_visit_the_course_page and_i_click_on_basic_details