diff --git a/app/forms/journeys/get_a_teacher_relocation_payment/employment_details_form.rb b/app/forms/journeys/get_a_teacher_relocation_payment/employment_details_form.rb
deleted file mode 100644
index 636472afca..0000000000
--- a/app/forms/journeys/get_a_teacher_relocation_payment/employment_details_form.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-module Journeys
- module GetATeacherRelocationPayment
- class EmploymentDetailsForm < Form
- attribute :school_headteacher_name, :string
- attribute :school_name, :string
- attribute :school_address_line_1, :string
- attribute :school_address_line_2, :string
- attribute :school_city, :string
- attribute :school_postcode, :string
-
- validates :school_headteacher_name,
- presence: {
- message: i18n_error_message(:school_headteacher_name)
- }
-
- validates :school_name,
- presence: {
- message: i18n_error_message(:school_name)
- }
-
- validates :school_address_line_1,
- presence: {
- message: i18n_error_message(:school_address_line_1)
- }
-
- validates :school_city,
- presence: {
- message: i18n_error_message(:school_city)
- }
-
- validates :school_postcode,
- presence: {
- message: i18n_error_message(:school_postcode)
- }
-
- validate :school_postcode_is_valid, if: -> { school_postcode.present? }
-
- def save
- return false unless valid?
-
- journey_session.answers.assign_attributes(
- school_headteacher_name: school_headteacher_name,
- school_name: school_name,
- school_address_line_1: school_address_line_1,
- school_address_line_2: school_address_line_2,
- school_city: school_city,
- school_postcode: school_postcode
- )
-
- journey_session.save!
- end
-
- private
-
- def school_postcode_is_valid
- unless UKPostcode.parse(school_postcode).full_valid?
- errors.add(:school_postcode, i18n_errors_path(:school_postcode))
- end
- end
- end
- end
-end
diff --git a/app/forms/journeys/get_a_teacher_relocation_payment/headteacher_details_form.rb b/app/forms/journeys/get_a_teacher_relocation_payment/headteacher_details_form.rb
new file mode 100644
index 0000000000..ca1b123c1f
--- /dev/null
+++ b/app/forms/journeys/get_a_teacher_relocation_payment/headteacher_details_form.rb
@@ -0,0 +1,22 @@
+module Journeys
+ module GetATeacherRelocationPayment
+ class HeadteacherDetailsForm < Form
+ attribute :school_headteacher_name, :string
+
+ validates :school_headteacher_name,
+ presence: {
+ message: i18n_error_message(:school_headteacher_name)
+ }
+
+ def save
+ return false unless valid?
+
+ journey_session.answers.assign_attributes(
+ school_headteacher_name: school_headteacher_name
+ )
+
+ journey_session.save!
+ end
+ end
+ end
+end
diff --git a/app/models/journeys/get_a_teacher_relocation_payment.rb b/app/models/journeys/get_a_teacher_relocation_payment.rb
index 72851e25f9..37e9b48739 100644
--- a/app/models/journeys/get_a_teacher_relocation_payment.rb
+++ b/app/models/journeys/get_a_teacher_relocation_payment.rb
@@ -18,7 +18,7 @@ module GetATeacherRelocationPayment
"entry-date" => EntryDateForm,
"nationality" => NationalityForm,
"passport-number" => PassportNumberForm,
- "employment-details" => EmploymentDetailsForm
+ "headteacher-details" => HeadteacherDetailsForm
}
}
end
diff --git a/app/models/journeys/get_a_teacher_relocation_payment/answers_presenter.rb b/app/models/journeys/get_a_teacher_relocation_payment/answers_presenter.rb
index b4ad7fe7f7..7d7a51eed6 100644
--- a/app/models/journeys/get_a_teacher_relocation_payment/answers_presenter.rb
+++ b/app/models/journeys/get_a_teacher_relocation_payment/answers_presenter.rb
@@ -24,12 +24,8 @@ def identity_answers
def employment_answers
[].tap do |a|
+ a << current_school
a << school_headteacher_name
- a << school_name
- a << school_address_line_1
- a << school_address_line_2 if answers.school_address_line_2.present?
- a << school_city
- a << school_postcode
end
end
@@ -111,51 +107,19 @@ def passport_number
]
end
- def school_headteacher_name
- [
- t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_headteacher_name"),
- answers.school_headteacher_name,
- "employment-details"
- ]
- end
-
- def school_name
- [
- t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_name"),
- answers.school_name,
- "employment-details"
- ]
- end
-
- def school_address_line_1
+ def current_school
[
- t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_address_line_1"),
- answers.school_address_line_1,
- "employment-details"
+ t("get_a_teacher_relocation_payment.forms.current_school.questions.current_school_search"),
+ answers.current_school.name,
+ "current-school"
]
end
- def school_address_line_2
- [
- t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_address_line_2"),
- answers.school_address_line_2,
- "employment-details"
- ]
- end
-
- def school_city
- [
- t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_city"),
- answers.school_city,
- "employment-details"
- ]
- end
-
- def school_postcode
+ def school_headteacher_name
[
- t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_postcode"),
- answers.school_postcode,
- "employment-details"
+ t("get_a_teacher_relocation_payment.forms.headteacher_details.questions.school_headteacher_name"),
+ answers.school_headteacher_name,
+ "headteacher-details"
]
end
end
diff --git a/app/models/journeys/get_a_teacher_relocation_payment/session_answers.rb b/app/models/journeys/get_a_teacher_relocation_payment/session_answers.rb
index bd2b9f7fda..0857455b63 100644
--- a/app/models/journeys/get_a_teacher_relocation_payment/session_answers.rb
+++ b/app/models/journeys/get_a_teacher_relocation_payment/session_answers.rb
@@ -11,11 +11,6 @@ class SessionAnswers < Journeys::SessionAnswers
attribute :nationality, :string
attribute :passport_number, :string
attribute :school_headteacher_name, :string
- attribute :school_name, :string
- attribute :school_address_line_1, :string
- attribute :school_address_line_2, :string
- attribute :school_city, :string
- attribute :school_postcode, :string
def policy
Policies::InternationalRelocationPayments
diff --git a/app/models/journeys/get_a_teacher_relocation_payment/slug_sequence.rb b/app/models/journeys/get_a_teacher_relocation_payment/slug_sequence.rb
index 70bb70d24d..d38bca9d7e 100644
--- a/app/models/journeys/get_a_teacher_relocation_payment/slug_sequence.rb
+++ b/app/models/journeys/get_a_teacher_relocation_payment/slug_sequence.rb
@@ -15,7 +15,8 @@ class SlugSequence
PERSONAL_DETAILS_SLUGS = [
"nationality",
"passport-number",
- "employment-details",
+ "current-school",
+ "headteacher-details",
"personal-details",
"postcode-search",
"select-home-address",
diff --git a/app/views/get_a_teacher_relocation_payment/claims/_current_school_details.html.erb b/app/views/get_a_teacher_relocation_payment/claims/_current_school_details.html.erb
new file mode 100644
index 0000000000..8e213d7645
--- /dev/null
+++ b/app/views/get_a_teacher_relocation_payment/claims/_current_school_details.html.erb
@@ -0,0 +1 @@
+<%# NOOP %>
diff --git a/app/views/get_a_teacher_relocation_payment/claims/_current_school_question.html.erb b/app/views/get_a_teacher_relocation_payment/claims/_current_school_question.html.erb
new file mode 100644
index 0000000000..30b38736d9
--- /dev/null
+++ b/app/views/get_a_teacher_relocation_payment/claims/_current_school_question.html.erb
@@ -0,0 +1,3 @@
+
+ <%= label_tag :school_search, question, class: "govuk-label govuk-label--l" %>
+
diff --git a/app/views/get_a_teacher_relocation_payment/claims/_current_school_search_results_question.html.erb b/app/views/get_a_teacher_relocation_payment/claims/_current_school_search_results_question.html.erb
new file mode 100644
index 0000000000..a21b1c00ff
--- /dev/null
+++ b/app/views/get_a_teacher_relocation_payment/claims/_current_school_search_results_question.html.erb
@@ -0,0 +1,5 @@
+
diff --git a/app/views/get_a_teacher_relocation_payment/claims/employment_details.html.erb b/app/views/get_a_teacher_relocation_payment/claims/employment_details.html.erb
deleted file mode 100644
index 069916b530..0000000000
--- a/app/views/get_a_teacher_relocation_payment/claims/employment_details.html.erb
+++ /dev/null
@@ -1,73 +0,0 @@
-<% content_for(
- :page_title,
- page_title(
- t("get_a_teacher_relocation_payment.forms.employment_details.title"),
- journey: current_journey_routing_name,
- show_error: @form.errors.any?
- )
-) %>
-
-
-
- <%= t("get_a_teacher_relocation_payment.forms.employment_details.title") %>
-
-
- <%= form_for(
- @form,
- url: claim_path(current_journey_routing_name),
- builder: GOVUKDesignSystemFormBuilder::FormBuilder
- ) do |f| %>
- <%= f.govuk_error_summary %>
-
- <%= f.govuk_text_field(
- :school_headteacher_name,
- label: {
- text: t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_headteacher_name"),
- },
- ) %>
-
- <%= f.govuk_text_field(
- :school_name,
- label: {
- text: t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_name"),
- },
- ) %>
-
- <%= f.govuk_fieldset(
- legend: {
- text: t("get_a_teacher_relocation_payment.forms.employment_details.school_address_legend"),
- },
- ) do %>
- <%= f.govuk_text_field(
- :school_address_line_1,
- label: {
- text: t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_address_line_1"),
- },
- ) %>
-
- <%= f.govuk_text_field(
- :school_address_line_2,
- label: {
- text: t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_address_line_2"),
- },
- ) %>
-
- <%= f.govuk_text_field(
- :school_city,
- label: {
- text: t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_city"),
- },
- ) %>
-
- <%= f.govuk_text_field(
- :school_postcode,
- label: {
- text: t("get_a_teacher_relocation_payment.forms.employment_details.questions.school_postcode"),
- },
- ) %>
- <% end %>
-
- <%= f.govuk_submit %>
- <% end %>
-
-
diff --git a/app/views/get_a_teacher_relocation_payment/claims/headteacher_details.html.erb b/app/views/get_a_teacher_relocation_payment/claims/headteacher_details.html.erb
new file mode 100644
index 0000000000..0559a1ffd0
--- /dev/null
+++ b/app/views/get_a_teacher_relocation_payment/claims/headteacher_details.html.erb
@@ -0,0 +1,30 @@
+<% content_for(
+ :page_title,
+ page_title(
+ t("get_a_teacher_relocation_payment.forms.headteacher_details.questions.school_headteacher_name"),
+ journey: current_journey_routing_name,
+ show_error: @form.errors.any?
+ )
+) %>
+
+
+ <%= form_for(
+ @form,
+ url: claim_path(current_journey_routing_name),
+ builder: GOVUKDesignSystemFormBuilder::FormBuilder
+ ) do |f| %>
+ <%= f.govuk_error_summary %>
+
+ <%= f.govuk_text_field(
+ :school_headteacher_name,
+ label: {
+ text: t("get_a_teacher_relocation_payment.forms.headteacher_details.questions.school_headteacher_name"),
+ size: "l",
+ tag: "h1"
+ },
+ ) %>
+
+ <%= f.govuk_submit %>
+ <% end %>
+
+
diff --git a/config/analytics.yml b/config/analytics.yml
index 1584ca664f..c690b55c19 100644
--- a/config/analytics.yml
+++ b/config/analytics.yml
@@ -200,6 +200,7 @@ shared:
- visa_type
- date_of_entry
- nationality
+ - current_school_id
:schools:
- id
- urn
diff --git a/config/analytics_blocklist.yml b/config/analytics_blocklist.yml
index ba7e227dd4..14a3184c1c 100644
--- a/config/analytics_blocklist.yml
+++ b/config/analytics_blocklist.yml
@@ -99,11 +99,6 @@
:international_relocation_payments_eligibilities:
- passport_number
- school_headteacher_name
- - school_name
- - school_address_line_1
- - school_address_line_2
- - school_city
- - school_postcode
:levelling_up_premium_payments_eligibilities:
- teacher_reference_number
:early_career_payments_eligibilities:
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 1c9fb284fc..58e74ef139 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -752,22 +752,15 @@ en:
errors:
presence: "Enter your passport number"
invalid: "Invalid passport number"
- employment_details:
- title: "Employment information"
- school_address_legend: "Enter the school address"
+ current_school:
+ questions:
+ current_school_search: "Which school are you currently employed to teach at?"
+ current_school_results: "Which school are you currently employed to teach at?"
+ headteacher_details:
questions:
school_headteacher_name: "Enter the name of the headteacher of the school where you are employed as a teacher"
- school_name: "Enter the name of the school"
- school_address_line_1: "Address line 1"
- school_address_line_2: "Address line 2"
- school_city: "Town or city"
- school_postcode: "Postcode"
errors:
school_headteacher_name: "Enter the headteacher's name"
- school_name: "Enter the school name"
- school_address_line_1: "Enter your school's address"
- school_city: "Enter your school's city"
- school_postcode: "Enter a valid postcode (for example, BN1 1AA)"
check_your_answers:
part_one:
diff --git a/db/migrate/20240627121651_drop_eligibility_columns_from_international_relocation_payments.rb b/db/migrate/20240627121651_drop_eligibility_columns_from_international_relocation_payments.rb
new file mode 100644
index 0000000000..1363625ff2
--- /dev/null
+++ b/db/migrate/20240627121651_drop_eligibility_columns_from_international_relocation_payments.rb
@@ -0,0 +1,9 @@
+class DropEligibilityColumnsFromInternationalRelocationPayments < ActiveRecord::Migration[7.0]
+ def change
+ remove_column :international_relocation_payments_eligibilities, :school_name
+ remove_column :international_relocation_payments_eligibilities, :school_address_line_1
+ remove_column :international_relocation_payments_eligibilities, :school_address_line_2
+ remove_column :international_relocation_payments_eligibilities, :school_city
+ remove_column :international_relocation_payments_eligibilities, :school_postcode
+ end
+end
diff --git a/db/migrate/20240627145713_add_current_school_id_to_international_relocation_payments_eligibilities.rb b/db/migrate/20240627145713_add_current_school_id_to_international_relocation_payments_eligibilities.rb
new file mode 100644
index 0000000000..e079c35faf
--- /dev/null
+++ b/db/migrate/20240627145713_add_current_school_id_to_international_relocation_payments_eligibilities.rb
@@ -0,0 +1,11 @@
+class AddCurrentSchoolIdToInternationalRelocationPaymentsEligibilities < ActiveRecord::Migration[7.0]
+ def change
+ add_reference :international_relocation_payments_eligibilities,
+ :current_school,
+ type: :uuid,
+ foreign_key: {to_table: :schools},
+ index: {
+ name: "index_irb_eligibilities_on_current_school_id"
+ }
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index f63cb06b77..ff00b13637 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.0].define(version: 2024_06_27_114644) do
+ActiveRecord::Schema[7.0].define(version: 2024_06_27_145713) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
enable_extension "pgcrypto"
@@ -200,11 +200,8 @@
t.string "nationality"
t.string "passport_number"
t.string "school_headteacher_name"
- t.string "school_name"
- t.string "school_address_line_1"
- t.string "school_address_line_2"
- t.string "school_city"
- t.string "school_postcode"
+ t.uuid "current_school_id"
+ t.index ["current_school_id"], name: "index_irb_eligibilities_on_current_school_id"
end
create_table "journey_configurations", primary_key: "routing_name", id: :string, force: :cascade do |t|
@@ -488,6 +485,7 @@
add_foreign_key "claims", "journeys_sessions"
add_foreign_key "decisions", "dfe_sign_in_users", column: "created_by_id"
add_foreign_key "early_career_payments_eligibilities", "schools", column: "current_school_id"
+ add_foreign_key "international_relocation_payments_eligibilities", "schools", column: "current_school_id"
add_foreign_key "levelling_up_premium_payments_eligibilities", "schools", column: "current_school_id"
add_foreign_key "notes", "claims"
add_foreign_key "notes", "dfe_sign_in_users", column: "created_by_id"
diff --git a/spec/factories/journeys/get_a_teacher_relocation_payment/get_a_teacher_relocation_payment_answers.rb b/spec/factories/journeys/get_a_teacher_relocation_payment/get_a_teacher_relocation_payment_answers.rb
index fc70a880c8..95afde839f 100644
--- a/spec/factories/journeys/get_a_teacher_relocation_payment/get_a_teacher_relocation_payment_answers.rb
+++ b/spec/factories/journeys/get_a_teacher_relocation_payment/get_a_teacher_relocation_payment_answers.rb
@@ -67,12 +67,8 @@
end
trait :with_employment_details do
+ current_school_id { create(:school).id }
school_headteacher_name { "Seymour Skinner" }
- school_name { "Springfield Elementary School" }
- school_address_line_1 { "Springfield Elementary School" }
- school_address_line_2 { "Plympton Street" }
- school_city { "Springfield" }
- school_postcode { "TE57 1NG" }
end
trait :eligible_teacher do
diff --git a/spec/features/get_a_teacher_relocation_payment/teacher_route_completing_the_form_spec.rb b/spec/features/get_a_teacher_relocation_payment/teacher_route_completing_the_form_spec.rb
index 26fc3916a9..2e4183a112 100644
--- a/spec/features/get_a_teacher_relocation_payment/teacher_route_completing_the_form_spec.rb
+++ b/spec/features/get_a_teacher_relocation_payment/teacher_route_completing_the_form_spec.rb
@@ -15,6 +15,10 @@
contract_start_date - 1.week
end
+ let(:school) do
+ create(:school)
+ end
+
before do
journey_configuration
end
@@ -41,31 +45,33 @@
it "submits an application" do
and_i_complete_the_nationality_step_with(option: "Australian")
and_i_complete_the_passport_number_step_with(options: "123456789")
- and_i_complete_the_employment_details_step
+ and_i_complete_the_current_school_step(school)
+ and_i_complete_the_headteacher_step
and_i_complete_the_personal_details_step
and_i_complete_the_postcode_step
and_i_complete_the_email_address_step
and_i_dont_provide_my_mobile_number
and_i_provide_my_personal_bank_details
and_i_complete_the_payroll_gender_step
- then_the_check_your_answers_part_page_shows_my_answers
+ then_the_check_your_answers_part_page_shows_my_answers(school)
and_i_submit_the_application
then_the_application_is_submitted_successfully
end
end
context "without postcode search" do
- it "submits an application" do
+ it "submits an application", js: true do
and_i_complete_the_nationality_step_with(option: "Australian")
and_i_complete_the_passport_number_step_with(options: "123456789")
- and_i_complete_the_employment_details_step
+ and_i_complete_the_current_school_step(school)
+ and_i_complete_the_headteacher_step
and_i_complete_the_personal_details_step
and_i_complete_the_manual_address_step
and_i_complete_the_email_address_step
and_i_dont_provide_my_mobile_number
and_i_provide_my_personal_bank_details
and_i_complete_the_payroll_gender_step
- then_the_check_your_answers_part_page_shows_my_answers
+ then_the_check_your_answers_part_page_shows_my_answers(school)
and_i_submit_the_application
then_the_application_is_submitted_successfully
end
@@ -75,14 +81,15 @@
it "submits an application" do
and_i_complete_the_nationality_step_with(option: "Australian")
and_i_complete_the_passport_number_step_with(options: "123456789")
- and_i_complete_the_employment_details_step
+ and_i_complete_the_current_school_step(school)
+ and_i_complete_the_headteacher_step
and_i_complete_the_personal_details_step
and_i_complete_the_manual_address_step
and_i_complete_the_email_address_step
and_i_provide_my_mobile_number
and_i_provide_my_personal_bank_details
and_i_complete_the_payroll_gender_step
- then_the_check_your_answers_part_page_shows_my_answers(mobile_number: true)
+ then_the_check_your_answers_part_page_shows_my_answers(school, mobile_number: true)
and_i_submit_the_application
then_the_application_is_submitted_successfully
end
@@ -92,7 +99,8 @@
it "submits an application" do
and_i_complete_the_nationality_step_with(option: "Australian")
and_i_complete_the_passport_number_step_with(options: "123456789")
- and_i_complete_the_employment_details_step
+ and_i_complete_the_current_school_step(school)
+ and_i_complete_the_headteacher_step
and_i_complete_the_personal_details_step
and_i_complete_the_manual_address_step
and_i_complete_the_email_address_step
@@ -100,6 +108,7 @@
and_i_provide_my_building_society_details
and_i_complete_the_payroll_gender_step
then_the_check_your_answers_part_page_shows_my_answers(
+ school,
mobile_number: true,
building_society: true
)
@@ -141,7 +150,7 @@ def then_the_check_your_answers_part_one_page_shows_my_answers
)
end
- def then_the_check_your_answers_part_page_shows_my_answers(mobile_number: false, building_society: false)
+ def then_the_check_your_answers_part_page_shows_my_answers(school, mobile_number: false, building_society: false)
expect(page).to have_text(
"What is your full name? Walter Seymour Skinner"
)
@@ -173,17 +182,9 @@ def then_the_check_your_answers_part_page_shows_my_answers(mobile_number: false,
)
expect(page).to have_text(
- "Enter the name of the school Springfield Elementary School"
+ "Which school are you currently employed to teach at? #{school.name}"
)
- expect(page).to have_text("Address line 1 Springfield Elementary School")
-
- expect(page).to have_text("Address line 2 Plympton Street")
-
- expect(page).to have_text("Town or city Springfield")
-
- expect(page).to have_text("Postcode TE57 1NG")
-
if mobile_number
expect(page).to have_text("Mobile number 01234567890")
else
diff --git a/spec/forms/journeys/get_a_teacher_relocation_payment/claim_submission_form_spec.rb b/spec/forms/journeys/get_a_teacher_relocation_payment/claim_submission_form_spec.rb
index dbee398f69..f9bbba704f 100644
--- a/spec/forms/journeys/get_a_teacher_relocation_payment/claim_submission_form_spec.rb
+++ b/spec/forms/journeys/get_a_teacher_relocation_payment/claim_submission_form_spec.rb
@@ -49,11 +49,7 @@
nationality: "Australian",
passport_number: "1234567890123456789A",
school_headteacher_name: "Seymour Skinner",
- school_name: "Springfield Elementary School",
- school_address_line_1: "Springfield Elementary School",
- school_address_line_2: "Plympton Street",
- school_city: "Springfield",
- school_postcode: "TE57 1NG"
+ current_school_id: create(:school).id
}
end
diff --git a/spec/forms/journeys/get_a_teacher_relocation_payment/employment_details_form_spec.rb b/spec/forms/journeys/get_a_teacher_relocation_payment/employment_details_form_spec.rb
deleted file mode 100644
index fd30f27460..0000000000
--- a/spec/forms/journeys/get_a_teacher_relocation_payment/employment_details_form_spec.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-require "rails_helper"
-
-RSpec.describe Journeys::GetATeacherRelocationPayment::EmploymentDetailsForm, type: :model do
- let(:journey_session) { create(:get_a_teacher_relocation_payment_session) }
-
- let(:params) { ActionController::Parameters.new(claim: {}) }
-
- let(:form) do
- described_class.new(
- journey_session: journey_session,
- journey: Journeys::GetATeacherRelocationPayment,
- params: params
- )
- end
-
- describe "validations" do
- subject { form }
-
- it do
- is_expected.to(
- validate_presence_of(:school_headteacher_name)
- .with_message("Enter the headteacher's name")
- )
- end
-
- it do
- is_expected.to(
- validate_presence_of(:school_name)
- .with_message("Enter the school name")
- )
- end
-
- it do
- is_expected.to(
- validate_presence_of(:school_address_line_1)
- .with_message("Enter your school's address")
- )
- end
-
- it do
- is_expected.to(
- validate_presence_of(:school_city)
- .with_message("Enter your school's city")
- )
- end
-
- it do
- is_expected.not_to(
- allow_value(nil)
- .for(:school_postcode)
- .with_message("Enter a valid postcode (for example, BN1 1AA)")
- )
- end
-
- it do
- is_expected.not_to(
- allow_value("fff fff")
- .for(:school_postcode)
- .with_message("Enter a valid postcode (for example, BN1 1AA)")
- )
- end
-
- it { is_expected.to(allow_value("BN1 1AA").for(:school_postcode)) }
- end
-
- describe "#save" do
- let(:params) do
- ActionController::Parameters.new(claim: {
- school_headteacher_name: "Seymour Skinner",
- school_name: "Springfield Elementary School",
- school_address_line_1: "19",
- school_address_line_2: "Plympton Street",
- school_city: "Springfield",
- school_postcode: "TE57 1NG"
- })
- end
-
- it "updates the journey session" do
- expect { expect(form.save).to be(true) }.to(
- change { journey_session.reload.answers.school_headteacher_name }
- .to("Seymour Skinner")
- .and(
- change { journey_session.reload.answers.school_name }
- .to("Springfield Elementary School")
- ).and(
- change { journey_session.reload.answers.school_address_line_1 }
- .to("19")
- ).and(
- change { journey_session.reload.answers.school_address_line_2 }
- .to("Plympton Street")
- ).and(
- change { journey_session.reload.answers.school_city }
- .to("Springfield")
- ).and(
- change { journey_session.reload.answers.school_postcode }
- .to("TE57 1NG")
- )
- )
- end
- end
-end
diff --git a/spec/forms/journeys/get_a_teacher_relocation_payment/headteacher_details_form_spec.rb b/spec/forms/journeys/get_a_teacher_relocation_payment/headteacher_details_form_spec.rb
new file mode 100644
index 0000000000..faebf90e14
--- /dev/null
+++ b/spec/forms/journeys/get_a_teacher_relocation_payment/headteacher_details_form_spec.rb
@@ -0,0 +1,41 @@
+require "rails_helper"
+
+RSpec.describe Journeys::GetATeacherRelocationPayment::HeadteacherDetailsForm, type: :model do
+ let(:journey_session) { create(:get_a_teacher_relocation_payment_session) }
+
+ let(:params) { ActionController::Parameters.new(claim: {}) }
+
+ let(:form) do
+ described_class.new(
+ journey_session: journey_session,
+ journey: Journeys::GetATeacherRelocationPayment,
+ params: params
+ )
+ end
+
+ describe "validations" do
+ subject { form }
+
+ it do
+ is_expected.to(
+ validate_presence_of(:school_headteacher_name)
+ .with_message("Enter the headteacher's name")
+ )
+ end
+ end
+
+ describe "#save" do
+ let(:params) do
+ ActionController::Parameters.new(claim: {
+ school_headteacher_name: "Seymour Skinner"
+ })
+ end
+
+ it "updates the journey session" do
+ expect { expect(form.save).to be(true) }.to(
+ change { journey_session.reload.answers.school_headteacher_name }
+ .to("Seymour Skinner")
+ )
+ end
+ end
+end
diff --git a/spec/models/journeys/get_a_teacher_relocation_payment/answers_presenter_spec.rb b/spec/models/journeys/get_a_teacher_relocation_payment/answers_presenter_spec.rb
index 54190e5b58..8023a9bb13 100644
--- a/spec/models/journeys/get_a_teacher_relocation_payment/answers_presenter_spec.rb
+++ b/spec/models/journeys/get_a_teacher_relocation_payment/answers_presenter_spec.rb
@@ -105,34 +105,14 @@
it do
is_expected.to include(
[
- "Enter the name of the headteacher of the school where you are employed as a teacher",
- "Seymour Skinner",
- "employment-details"
- ],
- [
- "Enter the name of the school",
- "Springfield Elementary School",
- "employment-details"
- ],
- [
- "Address line 1",
- "Springfield Elementary School",
- "employment-details"
+ "Which school are you currently employed to teach at?",
+ answers.current_school.name,
+ "current-school"
],
[
- "Address line 2",
- "Plympton Street",
- "employment-details"
- ],
- [
- "Town or city",
- "Springfield",
- "employment-details"
- ],
- [
- "Postcode",
- "TE57 1NG",
- "employment-details"
+ "Enter the name of the headteacher of the school where you are employed as a teacher",
+ "Seymour Skinner",
+ "headteacher-details"
]
)
end
diff --git a/spec/support/get_a_teacher_relocation_payment/step_helpers.rb b/spec/support/get_a_teacher_relocation_payment/step_helpers.rb
index 06c9234728..bf8369cd4a 100644
--- a/spec/support/get_a_teacher_relocation_payment/step_helpers.rb
+++ b/spec/support/get_a_teacher_relocation_payment/step_helpers.rb
@@ -93,26 +93,28 @@ def and_i_complete_the_passport_number_step_with(options:)
click_button("Continue")
end
- def and_i_complete_the_employment_details_step
- assert_on_employment_details_page!
+ def and_i_complete_the_current_school_step(school)
+ assert_on_current_school_page!
fill_in(
- "Enter the name of the headteacher of the school where you are employed as a teacher",
- with: "Seymour Skinner"
+ "Which school are you currently employed to teach at?",
+ with: school.name
)
- fill_in(
- "Enter the name of the school",
- with: "Springfield Elementary School"
- )
+ click_button "Continue"
- fill_in("Address line 1", with: "Springfield Elementary School")
+ choose school.name
- fill_in("Address line 2", with: "Plympton Street")
+ click_button "Continue"
+ end
- fill_in("Town or city", with: "Springfield")
+ def and_i_complete_the_headteacher_step
+ assert_on_headteacher_page!
- fill_in("Postcode", with: "TE57 1NG")
+ fill_in(
+ "Enter the name of the headteacher of the school where you are employed as a teacher",
+ with: "Seymour Skinner"
+ )
click_button("Continue")
end
@@ -315,8 +317,16 @@ def assert_on_passport_number_page!
)
end
- def assert_on_employment_details_page!
- expect(page).to have_text("Employment information")
+ def assert_on_current_school_page!
+ expect(page).to have_text(
+ "Which school are you currently employed to teach at?"
+ )
+ end
+
+ def assert_on_headteacher_page!
+ expect(page).to have_text(
+ "Enter the name of the headteacher of the school where you are employed as a teacher"
+ )
end
def assert_on_personal_details_page!