From f2f44329f36a03507179a3cf714236d1c0b6d990 Mon Sep 17 00:00:00 2001
From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com>
Date: Wed, 30 Oct 2024 13:19:54 +0000
Subject: [PATCH] CLDC-3684 Extract lettings tenancy information copy (#2731)
* Extract lettings tenancy information copy
* Fix flaky merged schemes test
---
.../lettings/pages/starter_tenancy_type.rb | 1 +
.../form/lettings/pages/tenancy_length.rb | 1 +
.../pages/tenancy_length_affordable_rent.rb | 1 +
.../pages/tenancy_length_intermediate_rent.rb | 1 +
.../lettings/pages/tenancy_length_periodic.rb | 1 +
.../form/lettings/pages/tenancy_type.rb | 1 +
app/models/form/lettings/questions/joint.rb | 3 -
.../form/lettings/questions/sheltered.rb | 3 -
.../questions/starter_tenancy_type.rb | 4 +-
.../form/lettings/questions/startertenancy.rb | 11 ----
.../form/lettings/questions/tenancy_length.rb | 4 +-
.../tenancy_length_affordable_rent.rb | 11 +---
.../tenancy_length_intermediate_rent.rb | 11 +---
.../questions/tenancy_length_periodic.rb | 4 +-
.../form/lettings/questions/tenancy_other.rb | 4 +-
.../form/lettings/questions/tenancy_type.rb | 4 +-
.../2023/lettings/tenancy_information.en.yml | 66 +++++++++++++++++++
.../2024/lettings/tenancy_information.en.yml | 66 +++++++++++++++++++
.../questions/starter_tenancy_type_spec.rb | 2 +-
.../tenancy_length_affordable_rent_spec.rb | 2 +-
.../tenancy_length_intermediate_rent_spec.rb | 2 +-
.../questions/tenancy_length_periodic_spec.rb | 2 +-
.../lettings/questions/tenancy_length_spec.rb | 2 +-
.../lettings/questions/tenancy_other_spec.rb | 2 +-
.../lettings/questions/tenancy_type_spec.rb | 2 +-
.../merge/merge_organisations_service_spec.rb | 6 +-
26 files changed, 155 insertions(+), 62 deletions(-)
create mode 100644 config/locales/forms/2023/lettings/tenancy_information.en.yml
create mode 100644 config/locales/forms/2024/lettings/tenancy_information.en.yml
diff --git a/app/models/form/lettings/pages/starter_tenancy_type.rb b/app/models/form/lettings/pages/starter_tenancy_type.rb
index fe147bc77..462d4fb37 100644
--- a/app/models/form/lettings/pages/starter_tenancy_type.rb
+++ b/app/models/form/lettings/pages/starter_tenancy_type.rb
@@ -2,6 +2,7 @@ class Form::Lettings::Pages::StarterTenancyType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "starter_tenancy_type"
+ @copy_key = "lettings.tenancy_information.tenancy.starter_tenancy_type"
@depends_on = [{ "starter_tenancy?" => true }]
end
diff --git a/app/models/form/lettings/pages/tenancy_length.rb b/app/models/form/lettings/pages/tenancy_length.rb
index 006cd8e42..b855133bf 100644
--- a/app/models/form/lettings/pages/tenancy_length.rb
+++ b/app/models/form/lettings/pages/tenancy_length.rb
@@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLength < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length"
+ @copy_key = "lettings.tenancy_information.tenancylength.tenancy_length"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "needstype" => 2 }]
end
diff --git a/app/models/form/lettings/pages/tenancy_length_affordable_rent.rb b/app/models/form/lettings/pages/tenancy_length_affordable_rent.rb
index aa88d81f9..cb292823a 100644
--- a/app/models/form/lettings/pages/tenancy_length_affordable_rent.rb
+++ b/app/models/form/lettings/pages/tenancy_length_affordable_rent.rb
@@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthAffordableRent < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length_affordable_rent"
+ @copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_affordable_rent"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => true, "needstype" => 1 }]
end
diff --git a/app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb b/app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb
index 070d0abe1..a693a6f3d 100644
--- a/app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb
+++ b/app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb
@@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthIntermediateRent < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length_intermediate_rent"
+ @copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_intermediate_rent"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => false, "needstype" => 1 }]
end
diff --git a/app/models/form/lettings/pages/tenancy_length_periodic.rb b/app/models/form/lettings/pages/tenancy_length_periodic.rb
index 9ea6553af..82972e796 100644
--- a/app/models/form/lettings/pages/tenancy_length_periodic.rb
+++ b/app/models/form/lettings/pages/tenancy_length_periodic.rb
@@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthPeriodic < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length_periodic"
+ @copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_periodic"
@depends_on = [{ "tenancy_type_periodic?" => true }]
end
diff --git a/app/models/form/lettings/pages/tenancy_type.rb b/app/models/form/lettings/pages/tenancy_type.rb
index c15f6f27a..2d7eceb5f 100644
--- a/app/models/form/lettings/pages/tenancy_type.rb
+++ b/app/models/form/lettings/pages/tenancy_type.rb
@@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_type"
+ @copy_key = "lettings.tenancy_information.tenancy.tenancy_type"
@depends_on = [{ "starter_tenancy?" => false }]
end
diff --git a/app/models/form/lettings/questions/joint.rb b/app/models/form/lettings/questions/joint.rb
index 5f3379c5d..e28a0085c 100644
--- a/app/models/form/lettings/questions/joint.rb
+++ b/app/models/form/lettings/questions/joint.rb
@@ -2,11 +2,8 @@ class Form::Lettings::Questions::Joint < ::Form::Question
def initialize(id, hsh, page)
super
@id = "joint"
- @check_answer_label = "Is this a joint tenancy?"
- @header = "Is this a joint tenancy?"
@type = "radio"
@check_answers_card_number = 0
- @hint_text = form.start_year_after_2024? ? "This is where two or more people are named on the tenancy agreement" : ""
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
diff --git a/app/models/form/lettings/questions/sheltered.rb b/app/models/form/lettings/questions/sheltered.rb
index 7b78a9b30..7b80bb5bf 100644
--- a/app/models/form/lettings/questions/sheltered.rb
+++ b/app/models/form/lettings/questions/sheltered.rb
@@ -2,11 +2,8 @@ class Form::Lettings::Questions::Sheltered < ::Form::Question
def initialize(id, hsh, page)
super
@id = "sheltered"
- @check_answer_label = "Is this letting in sheltered accommodation?"
- @header = "Is this letting in sheltered accommodation?"
@type = "radio"
@check_answers_card_number = 0
- @hint_text = "Sheltered housing and special retirement housing are for tenants with low-level care and support needs. This typically provides some limited support to enable independent living, such as alarm-based assistance or a scheme manager.Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission."
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
diff --git a/app/models/form/lettings/questions/starter_tenancy_type.rb b/app/models/form/lettings/questions/starter_tenancy_type.rb
index 9157c8e18..85d4a14ff 100644
--- a/app/models/form/lettings/questions/starter_tenancy_type.rb
+++ b/app/models/form/lettings/questions/starter_tenancy_type.rb
@@ -2,11 +2,9 @@ class Form::Lettings::Questions::StarterTenancyType < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancy"
- @check_answer_label = form.start_year_after_2024? ? "Type of main tenancy after the starter or introductory period has ended" : "Type of main tenancy after the starter period has ended"
- @header = form.start_year_after_2024? ? "What is the type of tenancy after the starter or introductory period has ended?" : "What is the type of tenancy after the starter period has ended?"
+ @copy_key = "lettings.tenancy_information.tenancy.#{page.id}.tenancy"
@type = "radio"
@check_answers_card_number = 0
- @hint_text = form.start_year_after_2024? ? "" : "This is also known as an ‘introductory period’."
@conditional_for = { "tenancyother" => [3] }
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
diff --git a/app/models/form/lettings/questions/startertenancy.rb b/app/models/form/lettings/questions/startertenancy.rb
index 0e461a25e..44b592cd6 100644
--- a/app/models/form/lettings/questions/startertenancy.rb
+++ b/app/models/form/lettings/questions/startertenancy.rb
@@ -2,8 +2,6 @@ class Form::Lettings::Questions::Startertenancy < ::Form::Question
def initialize(id, hsh, page)
super
@id = "startertenancy"
- @check_answer_label = "Is this a starter or introductory tenancy?"
- @header = "Is this a starter tenancy?"
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
@@ -12,14 +10,5 @@ class Form::Lettings::Questions::Startertenancy < ::Form::Question
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "2" => { "value" => "No" } }.freeze
- def hint_text
- if form.start_year_after_2024?
- "If the tenancy has an ‘introductory period’ answer ‘yes’.
- You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy."
- else
- "This is also known as an ‘introductory period’."
- end
- end
-
QUESTION_NUMBER_FROM_YEAR = { 2023 => 26 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_length.rb b/app/models/form/lettings/questions/tenancy_length.rb
index b94d41af5..1bf868377 100644
--- a/app/models/form/lettings/questions/tenancy_length.rb
+++ b/app/models/form/lettings/questions/tenancy_length.rb
@@ -2,14 +2,12 @@ class Form::Lettings::Questions::TenancyLength < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancylength"
- @check_answer_label = "Length of fixed-term tenancy"
- @header = "What is the length of the fixed-term tenancy to the nearest year?"
+ @copy_key = "lettings.tenancy_information.tenancylength.#{page.id}"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@max = 150
@min = 0
- @hint_text = "Do not include the starter or introductory period."
@step = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
diff --git a/app/models/form/lettings/questions/tenancy_length_affordable_rent.rb b/app/models/form/lettings/questions/tenancy_length_affordable_rent.rb
index bea745ae1..8e79924aa 100644
--- a/app/models/form/lettings/questions/tenancy_length_affordable_rent.rb
+++ b/app/models/form/lettings/questions/tenancy_length_affordable_rent.rb
@@ -2,8 +2,7 @@ class Form::Lettings::Questions::TenancyLengthAffordableRent < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancylength"
- @check_answer_label = "Length of fixed-term tenancy"
- @header = "What is the length of the fixed-term tenancy to the nearest year?"
+ @copy_key = "lettings.tenancy_information.tenancylength.#{page.id}"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@@ -13,13 +12,5 @@ class Form::Lettings::Questions::TenancyLengthAffordableRent < ::Form::Question
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
- def hint_text
- if form.start_year_after_2024?
- "Do not include the starter or introductory period.The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years."
- else
- "Do not include the starter or introductory period.The minimum period is 2 years for social or affordable rent general needs logs and you do not need a log for shorter tenancies."
- end
- end
-
QUESTION_NUMBER_FROM_YEAR = { 2023 => 28 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb b/app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb
index 835efd429..1bf3bd7cc 100644
--- a/app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb
+++ b/app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb
@@ -2,8 +2,7 @@ class Form::Lettings::Questions::TenancyLengthIntermediateRent < ::Form::Questio
def initialize(id, hsh, page)
super
@id = "tenancylength"
- @check_answer_label = "Length of fixed-term tenancy"
- @header = "What is the length of the fixed-term tenancy to the nearest year?"
+ @copy_key = "lettings.tenancy_information.tenancylength.#{page.id}"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@@ -13,13 +12,5 @@ class Form::Lettings::Questions::TenancyLengthIntermediateRent < ::Form::Questio
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
- def hint_text
- if form.start_year_after_2024?
- "Do not include the starter or introductory period.The minimum period is 1 year for intermediate rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 1 year."
- else
- "Do not include the starter or introductory period.The minimum period is 1 year for intermediate rent general needs logs and you do not need a log for shorter tenancies."
- end
- end
-
QUESTION_NUMBER_FROM_YEAR = { 2023 => 28 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_length_periodic.rb b/app/models/form/lettings/questions/tenancy_length_periodic.rb
index 113435dd6..c65f41399 100644
--- a/app/models/form/lettings/questions/tenancy_length_periodic.rb
+++ b/app/models/form/lettings/questions/tenancy_length_periodic.rb
@@ -2,8 +2,7 @@ class Form::Lettings::Questions::TenancyLengthPeriodic < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancylength"
- @check_answer_label = "Length of periodic tenancy"
- @header = "What is the length of the periodic tenancy to the nearest year?"
+ @copy_key = "lettings.tenancy_information.tenancylength.#{page.id}"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@@ -11,7 +10,6 @@ class Form::Lettings::Questions::TenancyLengthPeriodic < ::Form::Question
@min = 0
@step = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
- @hint_text = "As this is a periodic tenancy, this question is optional. If you do not have the information available click save and continue"
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 28 }.freeze
diff --git a/app/models/form/lettings/questions/tenancy_other.rb b/app/models/form/lettings/questions/tenancy_other.rb
index 21e932250..3fb3469ee 100644
--- a/app/models/form/lettings/questions/tenancy_other.rb
+++ b/app/models/form/lettings/questions/tenancy_other.rb
@@ -2,11 +2,9 @@ class Form::Lettings::Questions::TenancyOther < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancyother"
- @check_answer_label = ""
- @header = "Please state the tenancy type"
+ @copy_key = "lettings.tenancy_information.tenancy.#{page.id}.tenancyother"
@type = "text"
@check_answers_card_number = 0
- @hint_text = ""
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
diff --git a/app/models/form/lettings/questions/tenancy_type.rb b/app/models/form/lettings/questions/tenancy_type.rb
index b4ed6aca4..9a83b44cb 100644
--- a/app/models/form/lettings/questions/tenancy_type.rb
+++ b/app/models/form/lettings/questions/tenancy_type.rb
@@ -2,11 +2,9 @@ class Form::Lettings::Questions::TenancyType < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancy"
- @check_answer_label = "Type of main tenancy"
- @header = "What is the type of tenancy?"
+ @copy_key = "lettings.tenancy_information.tenancy.#{page.id}.tenancy"
@type = "radio"
@check_answers_card_number = 0
- @hint_text = ""
@conditional_for = { "tenancyother" => [3] }
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
diff --git a/config/locales/forms/2023/lettings/tenancy_information.en.yml b/config/locales/forms/2023/lettings/tenancy_information.en.yml
new file mode 100644
index 000000000..e9331d4dc
--- /dev/null
+++ b/config/locales/forms/2023/lettings/tenancy_information.en.yml
@@ -0,0 +1,66 @@
+en:
+ forms:
+ 2023:
+ lettings:
+ tenancy_information:
+ joint:
+ page_header: ""
+ check_answer_label: "Is this a joint tenancy?"
+ hint_text: ""
+ question_text: "Is this a joint tenancy?"
+
+ startertenancy:
+ page_header: ""
+ check_answer_label: "Is this a starter or introductory tenancy?"
+ hint_text: "This is also known as an ‘introductory period’."
+ question_text: "Is this a starter tenancy?"
+
+ tenancy:
+ tenancy_type:
+ page_header: ""
+ tenancy:
+ check_answer_label: "Type of main tenancy"
+ hint_text: ""
+ question_text: "What is the type of tenancy?"
+ tenancyother:
+ check_answer_label: ""
+ hint_text: ""
+ question_text: "Please state the tenancy type"
+ starter_tenancy_type:
+ page_header: ""
+ tenancy:
+ check_answer_label: "Type of main tenancy after the starter period has ended"
+ hint_text: "This is also known as an ‘introductory period’."
+ question_text: "What is the type of tenancy after the starter period has ended?"
+ tenancyother:
+ check_answer_label: ""
+ hint_text: ""
+ question_text: "Please state the tenancy type"
+
+ tenancylength:
+ tenancy_length:
+ page_header: ""
+ check_answer_label: "Length of fixed-term tenancy"
+ hint_text: "Do not include the starter or introductory period."
+ question_text: "What is the length of the fixed-term tenancy to the nearest year?"
+ tenancy_length_affordable_rent:
+ page_header: ""
+ check_answer_label: "Length of fixed-term tenancy"
+ hint_text: "Do not include the starter or introductory period.The minimum period is 2 years for social or affordable rent general needs logs and you do not need a log for shorter tenancies."
+ question_text: "What is the length of the fixed-term tenancy to the nearest year?"
+ tenancy_length_intermediate_rent:
+ page_header: ""
+ check_answer_label: "Length of fixed-term tenancy"
+ hint_text: "Do not include the starter or introductory period.The minimum period is 1 year for intermediate rent general needs logs and you do not need a log for shorter tenancies."
+ question_text: "What is the length of the fixed-term tenancy to the nearest year?"
+ tenancy_length_periodic:
+ page_header: ""
+ check_answer_label: "Length of periodic tenancy"
+ hint_text: "As this is a periodic tenancy, this question is optional. If you do not have the information available click save and continue"
+ question_text: "What is the length of the periodic tenancy to the nearest year?"
+
+ sheltered:
+ page_header: ""
+ check_answer_label: "Is this letting in sheltered accommodation?"
+ hint_text: "Sheltered housing and special retirement housing are for tenants with low-level care and support needs. This typically provides some limited support to enable independent living, such as alarm-based assistance or a scheme manager.Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission."
+ question_text: "Is this letting in sheltered accommodation?"
diff --git a/config/locales/forms/2024/lettings/tenancy_information.en.yml b/config/locales/forms/2024/lettings/tenancy_information.en.yml
new file mode 100644
index 000000000..bee380e7c
--- /dev/null
+++ b/config/locales/forms/2024/lettings/tenancy_information.en.yml
@@ -0,0 +1,66 @@
+en:
+ forms:
+ 2024:
+ lettings:
+ tenancy_information:
+ joint:
+ page_header: ""
+ check_answer_label: "Is this a joint tenancy?"
+ hint_text: "This is where two or more people are named on the tenancy agreement"
+ question_text: "Is this a joint tenancy?"
+
+ startertenancy:
+ page_header: ""
+ check_answer_label: "Is this a starter or introductory tenancy?"
+ hint_text: "If the tenancy has an ‘introductory period’ answer ‘yes’.
You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy."
+ question_text: "Is this a starter tenancy?"
+
+ tenancy:
+ tenancy_type:
+ page_header: ""
+ tenancy:
+ check_answer_label: "Type of main tenancy"
+ hint_text: ""
+ question_text: "What is the type of tenancy?"
+ tenancyother:
+ check_answer_label: ""
+ hint_text: ""
+ question_text: "Please state the tenancy type"
+ starter_tenancy_type:
+ page_header: ""
+ tenancy:
+ check_answer_label: "Type of main tenancy after the starter or introductory period has ended"
+ hint_text: ""
+ question_text: "What is the type of tenancy after the starter or introductory period has ended?"
+ tenancyother:
+ check_answer_label: ""
+ hint_text: ""
+ question_text: "Please state the tenancy type"
+
+ tenancylength:
+ tenancy_length:
+ page_header: ""
+ check_answer_label: "Length of fixed-term tenancy"
+ hint_text: "Do not include the starter or introductory period."
+ question_text: "What is the length of the fixed-term tenancy to the nearest year?"
+ tenancy_length_affordable_rent:
+ page_header: ""
+ check_answer_label: "Length of fixed-term tenancy"
+ hint_text: "Do not include the starter or introductory period.The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years."
+ question_text: "What is the length of the fixed-term tenancy to the nearest year?"
+ tenancy_length_intermediate_rent:
+ page_header: ""
+ check_answer_label: "Length of fixed-term tenancy"
+ hint_text: "Do not include the starter or introductory period.The minimum period is 1 year for intermediate rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 1 year."
+ question_text: "What is the length of the fixed-term tenancy to the nearest year?"
+ tenancy_length_periodic:
+ page_header: ""
+ check_answer_label: "Length of periodic tenancy"
+ hint_text: "As this is a periodic tenancy, this question is optional. If you do not have the information available click save and continue"
+ question_text: "What is the length of the periodic tenancy to the nearest year?"
+
+ sheltered:
+ page_header: ""
+ check_answer_label: "Is this letting in sheltered accommodation?"
+ hint_text: "Sheltered housing and special retirement housing are for tenants with low-level care and support needs. This typically provides some limited support to enable independent living, such as alarm-based assistance or a scheme manager.Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission."
+ question_text: "Is this letting in sheltered accommodation?"
diff --git a/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb b/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb
index 66ea2b355..d3022dfcf 100644
--- a/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb
+++ b/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::StarterTenancyType, type: :model do
let(:question_id) { nil }
let(:question_definition) { nil }
- let(:page) { instance_double(Form::Page) }
+ let(:page) { instance_double(Form::Page, id: "starter_tenancy_type") }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) }
diff --git a/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb b/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb
index fb334f909..4bab9187a 100644
--- a/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb
+++ b/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthAffordableRent, type: :mo
let(:question_id) { nil }
let(:question_definition) { nil }
- let(:page) { instance_double(Form::Page) }
+ let(:page) { instance_double(Form::Page, id: "affordable_tenancy_length") }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) }
diff --git a/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb b/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb
index 0c0923bf8..a3f9c80e2 100644
--- a/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb
+++ b/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthIntermediateRent, type: :
let(:question_id) { nil }
let(:question_definition) { nil }
- let(:page) { instance_double(Form::Page) }
+ let(:page) { instance_double(Form::Page, id: "intermediate_tenancy_length") }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) }
diff --git a/spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb b/spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb
index 3a0fae171..449677736 100644
--- a/spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb
+++ b/spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthPeriodic, type: :model do
let(:question_id) { nil }
let(:question_definition) { nil }
- let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
+ let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))), id: "periodic_tenancy_length") }
it "has correct page" do
expect(question.page).to eq(page)
diff --git a/spec/models/form/lettings/questions/tenancy_length_spec.rb b/spec/models/form/lettings/questions/tenancy_length_spec.rb
index 2d87d0923..cc7bf9f9f 100644
--- a/spec/models/form/lettings/questions/tenancy_length_spec.rb
+++ b/spec/models/form/lettings/questions/tenancy_length_spec.rb
@@ -3,7 +3,7 @@ require "rails_helper"
RSpec.describe Form::Lettings::Questions::TenancyLength, type: :model do
subject(:question) { described_class.new(nil, nil, page) }
- let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
+ let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))), id: "tenancy_length") }
it "has correct page" do
expect(question.page).to eq(page)
diff --git a/spec/models/form/lettings/questions/tenancy_other_spec.rb b/spec/models/form/lettings/questions/tenancy_other_spec.rb
index ce8aec5db..a6a2962dc 100644
--- a/spec/models/form/lettings/questions/tenancy_other_spec.rb
+++ b/spec/models/form/lettings/questions/tenancy_other_spec.rb
@@ -3,7 +3,7 @@ require "rails_helper"
RSpec.describe Form::Lettings::Questions::TenancyOther, type: :model do
subject(:question) { described_class.new(nil, nil, page) }
- let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
+ let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))), id: "tenancy_type") }
it "has correct page" do
expect(question.page).to eq(page)
diff --git a/spec/models/form/lettings/questions/tenancy_type_spec.rb b/spec/models/form/lettings/questions/tenancy_type_spec.rb
index 13998094a..08818d3ea 100644
--- a/spec/models/form/lettings/questions/tenancy_type_spec.rb
+++ b/spec/models/form/lettings/questions/tenancy_type_spec.rb
@@ -3,7 +3,7 @@ require "rails_helper"
RSpec.describe Form::Lettings::Questions::TenancyType, type: :model do
subject(:question) { described_class.new(nil, nil, page) }
- let(:page) { instance_double(Form::Page) }
+ let(:page) { instance_double(Form::Page, id: "tenancy_type") }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) }
diff --git a/spec/services/merge/merge_organisations_service_spec.rb b/spec/services/merge/merge_organisations_service_spec.rb
index 6eea8635f..7163a142f 100644
--- a/spec/services/merge/merge_organisations_service_spec.rb
+++ b/spec/services/merge/merge_organisations_service_spec.rb
@@ -1317,9 +1317,9 @@ RSpec.describe Merge::MergeOrganisationsService do
merging_organisation.reload
expect(new_absorbing_organisation.owned_lettings_logs.count).to eq(2)
expect(new_absorbing_organisation.managed_lettings_logs.count).to eq(1)
- expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log.id).scheme).to eq(new_absorbing_organisation.owned_schemes.first)
- expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log.id).location).to eq(new_absorbing_organisation.owned_schemes.first.locations.first)
- expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log_no_location.id).scheme).to eq(new_absorbing_organisation.owned_schemes.first)
+ expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log.id).scheme).to eq(new_absorbing_organisation.owned_schemes.find_by(service_name: scheme.service_name))
+ expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log.id).location).to eq(new_absorbing_organisation.owned_schemes.find_by(service_name: scheme.service_name).locations.first)
+ expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log_no_location.id).scheme).to eq(new_absorbing_organisation.owned_schemes.find_by(service_name: scheme.service_name))
expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log_no_location.id).location).to eq(nil)
end