115 changed files with 4131 additions and 629 deletions
@ -1,16 +1,42 @@ |
|||||||
module CollectionTimeHelper |
module CollectionTimeHelper |
||||||
|
def collection_start_year(date) |
||||||
|
window_end_date = Time.zone.local(date.year, 4, 1) |
||||||
|
date < window_end_date ? date.year - 1 : date.year |
||||||
|
end |
||||||
|
|
||||||
def current_collection_start_year |
def current_collection_start_year |
||||||
today = Time.zone.now |
collection_start_year(Time.zone.now) |
||||||
window_end_date = Time.zone.local(today.year, 4, 1) |
|
||||||
today < window_end_date ? today.year - 1 : today.year |
|
||||||
end |
end |
||||||
|
|
||||||
def collection_start_date(date) |
def collection_start_date(date) |
||||||
window_end_date = Time.zone.local(date.year, 4, 1) |
Time.zone.local(collection_start_year(date), 4, 1) |
||||||
date < window_end_date ? Time.zone.local(date.year - 1, 4, 1) : Time.zone.local(date.year, 4, 1) |
|
||||||
end |
end |
||||||
|
|
||||||
def current_collection_start_date |
def current_collection_start_date |
||||||
Time.zone.local(current_collection_start_year, 4, 1) |
Time.zone.local(current_collection_start_year, 4, 1) |
||||||
end |
end |
||||||
|
|
||||||
|
def collection_end_date(date) |
||||||
|
Time.zone.local(collection_start_year(date) + 1, 3, 31) |
||||||
|
end |
||||||
|
|
||||||
|
def current_collection_end_date |
||||||
|
Time.zone.local(current_collection_start_year + 1, 3, 31) |
||||||
|
end |
||||||
|
|
||||||
|
def previous_collection_end_date |
||||||
|
current_collection_end_date - 1.year |
||||||
|
end |
||||||
|
|
||||||
|
def next_collection_start_year |
||||||
|
current_collection_start_year + 1 |
||||||
|
end |
||||||
|
|
||||||
|
def previous_collection_start_year |
||||||
|
current_collection_start_year - 1 |
||||||
|
end |
||||||
|
|
||||||
|
def previous_collection_start_date |
||||||
|
current_collection_start_date - 1.year |
||||||
|
end |
||||||
end |
end |
||||||
|
|||||||
@ -0,0 +1,15 @@ |
|||||||
|
class Form::Sales::Pages::Buyer2EthnicBackgroundArab < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "buyer_2_ethnic_background_arab" |
||||||
|
@depends_on = [{ |
||||||
|
"ethnic_group2" => 4, |
||||||
|
}] |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Buyer2EthnicBackgroundArab.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
class Form::Sales::Pages::Buyer2EthnicBackgroundAsian < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "buyer_2_ethnic_background_asian" |
||||||
|
@depends_on = [{ |
||||||
|
"ethnic_group2" => 2, |
||||||
|
}] |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Buyer2EthnicBackgroundAsian.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
class Form::Sales::Pages::Buyer2EthnicBackgroundBlack < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "buyer_2_ethnic_background_black" |
||||||
|
@depends_on = [{ |
||||||
|
"ethnic_group2" => 3, |
||||||
|
}] |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Buyer2EthnicBackgroundBlack.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
class Form::Sales::Pages::Buyer2EthnicBackgroundMixed < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "buyer_2_ethnic_background_mixed" |
||||||
|
@depends_on = [{ |
||||||
|
"ethnic_group2" => 1, |
||||||
|
}] |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Buyer2EthnicBackgroundMixed.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
class Form::Sales::Pages::Buyer2EthnicBackgroundWhite < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "buyer_2_ethnic_background_white" |
||||||
|
@depends_on = [{ |
||||||
|
"ethnic_group2" => 0, |
||||||
|
}] |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Buyer2EthnicBackgroundWhite.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
class Form::Sales::Pages::Buyer2EthnicGroup < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "buyer_2_ethnic_group" |
||||||
|
@depends_on = [ |
||||||
|
{ |
||||||
|
"jointpur" => 1, |
||||||
|
"privacynotice" => 1, |
||||||
|
}, |
||||||
|
{ |
||||||
|
"jointpur" => 1, |
||||||
|
"noint" => 1, |
||||||
|
}, |
||||||
|
] |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Buyer2EthnicGroup.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,35 @@ |
|||||||
|
class Form::Sales::Pages::Buyer2IncomeValueCheck < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@header = "" |
||||||
|
@description = "" |
||||||
|
@subsection = subsection |
||||||
|
@depends_on = [ |
||||||
|
{ |
||||||
|
"income2_under_soft_min?" => true, |
||||||
|
}, |
||||||
|
] |
||||||
|
@title_text = { |
||||||
|
"translation" => "soft_validations.income.under_soft_min_for_economic_status", |
||||||
|
"arguments" => [ |
||||||
|
{ |
||||||
|
"key" => "field_formatted_as_currency", |
||||||
|
"arguments_for_key" => "income2", |
||||||
|
"i18n_template" => "income", |
||||||
|
}, |
||||||
|
{ |
||||||
|
"key" => "income_soft_min_for_ecstat", |
||||||
|
"arguments_for_key" => "ecstat2", |
||||||
|
"i18n_template" => "minimum", |
||||||
|
}, |
||||||
|
], |
||||||
|
} |
||||||
|
@informative_text = {} |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Buyer2IncomeValueCheck.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
class Form::Sales::Questions::Buyer2EthnicBackgroundArab < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "ethnicbuy2" |
||||||
|
@check_answer_label = "Buyer 2’s ethnic background" |
||||||
|
@header = "Which of the following best describes the buyer 2’s Arab background?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@check_answers_card_number = 2 |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"19" => { "value" => "Arab" }, |
||||||
|
"16" => { "value" => "Other ethnic group" }, |
||||||
|
}.freeze |
||||||
|
end |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
class Form::Sales::Questions::Buyer2EthnicBackgroundAsian < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "ethnicbuy2" |
||||||
|
@check_answer_label = "Buyer 2’s ethnic background" |
||||||
|
@header = "Which of the following best describes the buyer 2’s Asian or Asian British background?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@check_answers_card_number = 2 |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"10" => { "value" => "Bangladeshi" }, |
||||||
|
"15" => { "value" => "Chinese" }, |
||||||
|
"8" => { "value" => "Indian" }, |
||||||
|
"9" => { "value" => "Pakistani" }, |
||||||
|
"11" => { "value" => "Any other Asian or Asian British background" }, |
||||||
|
}.freeze |
||||||
|
end |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
class Form::Sales::Questions::Buyer2EthnicBackgroundBlack < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "ethnicbuy2" |
||||||
|
@check_answer_label = "Buyer 2’s ethnic background" |
||||||
|
@header = "Which of the following best describes the buyer 2’s Black, African, Caribbean or Black British background?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@check_answers_card_number = 2 |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"13" => { "value" => "African" }, |
||||||
|
"12" => { "value" => "Caribbean" }, |
||||||
|
"14" => { "value" => "Any other Black, African or Caribbean background" }, |
||||||
|
}.freeze |
||||||
|
end |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
class Form::Sales::Questions::Buyer2EthnicBackgroundMixed < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "ethnicbuy2" |
||||||
|
@check_answer_label = "Buyer 2’s ethnic background" |
||||||
|
@header = "Which of the following best describes the buyer 2’s Mixed or Multiple ethnic groups background?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@check_answers_card_number = 2 |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"4" => { "value" => "White and Black Caribbean" }, |
||||||
|
"5" => { "value" => "White and Black African" }, |
||||||
|
"6" => { "value" => "White and Asian" }, |
||||||
|
"7" => { "value" => "Any other Mixed or Multiple ethnic background" }, |
||||||
|
}.freeze |
||||||
|
end |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
class Form::Sales::Questions::Buyer2EthnicBackgroundWhite < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "ethnicbuy2" |
||||||
|
@check_answer_label = "Buyer 2’s ethnic background" |
||||||
|
@header = "Which of the following best describes the buyer 2’s White background?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@check_answers_card_number = 2 |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" }, |
||||||
|
"2" => { "value" => "Irish" }, |
||||||
|
"18" => { "value" => "Gypsy or Irish Traveller" }, |
||||||
|
"3" => { "value" => "Any other White background" }, |
||||||
|
}.freeze |
||||||
|
end |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
class Form::Sales::Questions::Buyer2EthnicGroup < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "ethnic_group2" |
||||||
|
@check_answer_label = "Buyer 2’s ethnic group" |
||||||
|
@header = "What is buyer 2’s ethnic group?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@inferred_check_answers_value = [{ |
||||||
|
"condition" => { |
||||||
|
"ethnic_group2" => 17, |
||||||
|
}, |
||||||
|
"value" => "Prefers not to say", |
||||||
|
}] |
||||||
|
@check_answers_card_number = 2 |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"0" => { "value" => "White" }, |
||||||
|
"1" => { "value" => "Mixed or Multiple ethnic groups" }, |
||||||
|
"2" => { "value" => "Asian or Asian British" }, |
||||||
|
"3" => { "value" => "Black, African, Caribbean or Black British" }, |
||||||
|
"4" => { "value" => "Arab or other ethnic group" }, |
||||||
|
"divider" => { "value" => true }, |
||||||
|
"17" => { "value" => "Buyer 1 prefers not to say" }, |
||||||
|
}.freeze |
||||||
|
end |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
class Form::Sales::Questions::Buyer2IncomeValueCheck < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "income2_value_check" |
||||||
|
@check_answer_label = "Income confirmation" |
||||||
|
@header = "Are you sure this is correct?" |
||||||
|
@type = "interruption_screen" |
||||||
|
@answer_options = { |
||||||
|
"0" => { "value" => "Yes" }, |
||||||
|
"1" => { "value" => "No" }, |
||||||
|
} |
||||||
|
@hidden_in_check_answers = { |
||||||
|
"depends_on" => [ |
||||||
|
{ |
||||||
|
"income2_value_check" => 0, |
||||||
|
}, |
||||||
|
{ |
||||||
|
"income2_value_check" => 1, |
||||||
|
}, |
||||||
|
], |
||||||
|
} |
||||||
|
@check_answers_card_number = 2 |
||||||
|
@page = page |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
class Form::Sales::Questions::StaircaseSale < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "staircasesale" |
||||||
|
@check_answer_label = "Part of a back-to-back staircasing transaction" |
||||||
|
@header = "Is this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"1" => { "value" => "Yes" }, |
||||||
|
"2" => { "value" => "No" }, |
||||||
|
"3" => { "value" => "Don't know" }, |
||||||
|
}.freeze |
||||||
|
end |
||||||
@ -1,11 +1,45 @@ |
|||||||
module Validations::Sales::SetupValidations |
module Validations::Sales::SetupValidations |
||||||
include Validations::SharedValidations |
include Validations::SharedValidations |
||||||
|
include CollectionTimeHelper |
||||||
|
|
||||||
def validate_saledate(record) |
def validate_saledate(record) |
||||||
return unless record.saledate && date_valid?("saledate", record) |
return unless record.saledate && date_valid?("saledate", record) |
||||||
|
|
||||||
unless record.saledate.between?(Time.zone.local(2022, 4, 1), Time.zone.local(2023, 3, 31)) || !FeatureToggle.saledate_collection_window_validation_enabled? |
unless record.saledate.between?(active_collection_start_date, current_collection_end_date) || !FeatureToggle.saledate_collection_window_validation_enabled? |
||||||
record.errors.add :saledate, I18n.t("validations.setup.saledate.financial_year") |
record.errors.add :saledate, validation_error_message |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
private |
||||||
|
|
||||||
|
def active_collection_start_date |
||||||
|
if FormHandler.instance.sales_in_crossover_period? |
||||||
|
previous_collection_start_date |
||||||
|
else |
||||||
|
current_collection_start_date |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
def validation_error_message |
||||||
|
current_end_year_long = current_collection_end_date.strftime("#{current_collection_end_date.day.ordinalize} %B %Y") |
||||||
|
|
||||||
|
if FormHandler.instance.sales_in_crossover_period? |
||||||
|
I18n.t( |
||||||
|
"validations.setup.saledate.previous_and_current_financial_year", |
||||||
|
previous_start_year_short: previous_collection_start_date.strftime("%y"), |
||||||
|
previous_end_year_short: previous_collection_end_date.strftime("%y"), |
||||||
|
previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"), |
||||||
|
current_end_year_short: current_collection_end_date.strftime("%y"), |
||||||
|
current_end_year_long:, |
||||||
|
) |
||||||
|
else |
||||||
|
I18n.t( |
||||||
|
"validations.setup.saledate.current_financial_year", |
||||||
|
current_start_year_short: current_collection_start_date.strftime("%y"), |
||||||
|
current_end_year_short: current_collection_end_date.strftime("%y"), |
||||||
|
current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"), |
||||||
|
current_end_year_long:, |
||||||
|
) |
||||||
end |
end |
||||||
end |
end |
||||||
end |
end |
||||||
|
|||||||
@ -1,46 +1,47 @@ |
|||||||
## How are we using your information? |
## How do we use your information? |
||||||
|
|
||||||
If your household has entered a new social housing tenancy, social housing providers will share your personal information with the Department for Levelling Up, Housing & Communities (DLUHC) for research and statistical purposes. |
If your household enters a new social housing tenancy or purchases a social housing property, social housing providers will share your personal information with the Department for Levelling Up, Housing & Communities (DLUHC) for research and statistical purposes only. |
||||||
|
|
||||||
## How is this information provided? |
## How do we get this information? |
||||||
|
|
||||||
The information is provided via ‘<%= t('service_name') %>’, a service funded and managed by DLUHC. It collects information on the tenants or buyers, tenancy or sale, and the dwelling itself. Some of this information is personal and sensitive, so DLUHC is responsible for ensuring that all data is processed in line with data protection legislation. |
The information is provided via ‘<%= t('service_name') %>’, a service funded and managed by DLUHC. It collects information on the tenants or residents, tenancy or sale, and the dwelling itself. Some of this data is personal and sensitive, so DLUHC is responsible for ensuring it’s processed in line with data protection legislation. |
||||||
|
|
||||||
## Why are we sharing this information? |
|
||||||
|
|
||||||
Information collected using this service is shared with other government departments and agencies. Data is shared with the Greater London Authority and the Regulator of Social Housing. Data providers can also access data for their organisations via the online service. Data is only shared for research and statistical purposes. |
## Why do we share this information? |
||||||
|
|
||||||
|
Information collected via CORE is shared with other government departments and agencies. It’s shared with the Greater London Authority and the Regulator of Social Housing. Data providers can also access data for their organisations via CORE. Data is only shared for research and statistical purposes. |
||||||
|
|
||||||
## How does this affect you? |
## How does this affect you? |
||||||
|
|
||||||
It will not affect your benefits, services or any treatments you receive. The information shared is anonymous and handled in accordance with the law. We are collecting and sharing your information to help us better understand the social housing market and inform social housing policy. |
Information sharing will not affect your benefits, services or any treatments you receive. It’s anonymous and handled in accordance with the law. We collect and share your information to help us better understand the social housing market and inform social housing policy. |
||||||
|
|
||||||
## If you want to know more |
## To find out more… |
||||||
|
|
||||||
Social housing lettings and sales data is collected on behalf of DLUHC for research and statistical purposes only. Data providers do not require the consent of tenants to provide the information, but tenants have the right to know how and for what purpose data is being collected, held and used. |
Social housing lettings and sales data is collected on DLUHC’s behalf. Data providers do not require the tenant or buyer’s consent to provide this information, but tenants and buyers have the right to know how and for what purpose data is being collected, held and used. |
||||||
|
|
||||||
The processing must have a lawful basis. In this case the processing is necessary for the performance of a task carried out in the public interest to meet a function of the Crown, a Minister of the Crown, or a government department. |
Data processing must have a lawful basis. In this case it’s necessary for a task carried out in the public interest meeting a function of the Crown, a Minister of the Crown, or government department. |
||||||
|
|
||||||
You have the right to object and you have the right to obtain confirmation that your data is being processed, and to access your personal data. You also have the right to have any incorrect personal data corrected. |
You have the right to object, and obtain confirmation that your data is being processed, as well as access your personal data, and have any incorrect personal data corrected. |
||||||
|
|
||||||
The information collected via this service relates to your tenancy, the dwelling you are living in or buying, and your household. Some of the information may have been provided by you as a tenant when signing the new tenancy or buying your property. Other information has been gathered from the housing management systems of social housing providers. |
Information collected via CORE relates to your tenancy, the dwelling you are living in or buying, and your household. Some information may have been provided by you (as a tenant or buyer) when signing the new tenancy or buying your property. Other information has been gathered from the housing management systems of social housing providers. |
||||||
|
|
||||||
Data collected will be held for as long as necessary for research and statistical purposes. When no longer needed, data will be deleted in a safe manner. We are aware that some of the data collected is particularly sensitive. For example: |
Collected data will be held for as long as necessary for research and statistical purposes. When no longer needed, data will be deleted in a safe manner. We’re aware some collected data is particularly sensitive. For example: |
||||||
|
|
||||||
* ethnic group |
* ethnic group |
||||||
* if previous tenure is a hospital or prison or approved probation hostel support |
* if previous tenure is a hospital, prison or approved probation hostel support |
||||||
* if household left last settled home because discharged from prison, a long stay hospital or other institution |
* if household left last settled home because discharged from prison, a long stay hospital or other institution |
||||||
* if source of referral is probation or prison, youth offending team, community mental health team or health service |
* if referral source is probation or prison, youth offending or community mental health team, or health service |
||||||
|
|
||||||
All the information collected via this service is treated in accordance with data protection requirements and guidelines. |
DLUHC publishes data annually, in aggregate form, as part of a report and complementary tables. |
||||||
|
|
||||||
Data is published by DLUHC in aggregate form on an annual basis as part of a report and complementary tables. |
* For annual lettings data, visit: [www.gov.uk/government/collections/rents-lettings-and-tenancies](www.gov.uk/government/collections/rents-lettings-and-tenancies) |
||||||
|
|
||||||
You can visit <www.gov.uk/government/collections/rents-lettings-and-tenancies> to access the annual publications on lettings. Or visit <gov.uk/government/collections/social-housing-sales-including-right-to-buy-and-transfers> to view the publications on sales. |
* For annual sales data, visit: [www.gov.uk/government/collections/social-housing-sales-including-right-to-buy-and-transfers](www.gov.uk/government/collections/social-housing-sales-including-right-to-buy-and-transfers) |
||||||
|
|
||||||
The detail level data is anonymised and protected to minimise the risk of identification and held with the UK Data Archive for research purposes. |
Detail-level data is anonymised and protected, minimising identification risk. It's held with the UK Data Archive. |
||||||
|
|
||||||
## Making a complaint |
## Complaints |
||||||
|
|
||||||
If you are unhappy with any aspect of this privacy notice, or how your personal information is being processed, contact the Department Data Protection Officer at: <dataprotection@communities.gsi.gov.uk> |
If you’re unhappy with any privacy notice aspect, or how we process your information, contact the Department Data Protection Officer: <dataprotection@communities.gsi.gov.uk> |
||||||
|
|
||||||
If you are still not happy, you have the right to lodge a complaint with the Information Commissioner’s Office (ICO) at [ico.org.uk/concern](https://ico.org.uk/concern). |
You also have the right to complain to the Information Commissioner’s Office (ICO): [www.ico.org.uk/concern](www.ico.org.uk/concern) |
||||||
|
|||||||
@ -1 +1 @@ |
|||||||
PWC9A1AmalyFv4A63MG9jCm2YtwE1Eyu1BJKodtbmq2nW7FD9svZZ3V4yC0JO9J8sLfCS6UrxQC4TOKKYWP5iYpOr5TKPi9MqNCVueLsoErN+nMAPhCJVpl8+eJ4BOvNYGlmle4bcwbAvHLq6IoANTBjktFh5/tgJS+IHBWK1FwPzK1eAhgQ1fE1jluWslee4iYesmh+ufHIMZAkoWuGJVky4i4uN5nKnwQfaPN5MUxBlvGiDH+s+yex4pcIaJ6hxYWAQRZXJRQVpZcf/agwU0Tk/S/fuDMm8zVeHCQkkmsCYzH5czB8b8IWYwyslqFBZNCix7YnbgwgYk8MUh7wPBuF8CFoPKVyteqic9HgUp9KY8kkt/RcWJ4zpv+Vwz3cre+iZ3S1bxFcSxXqO0MGRug2H9iwhAnBQDLl3vXLNNRYEL5LhNv0Z9Cy7at1fnYe1FcvF+3DR9kG/RAYzR8S2eEDdzBl797+DG81yhfkjP3/gfWxD+J+Mx0F4SDEOaGK5c/MqNTdiRRbnhzuRaQFMg6itoJbZybe+EOQScNft1QLqC4QwPd4Qevhj/A=--QffpsNB1u+1Lk/tD--spkCqBIGHl8g6HGwd89yCg== |
EZNV2LiNWzf52erbQ41Dz3Bh+2f3Uih8liEyhXp5XzHCLzAbmN6/IJqr7b9cTZiCiroFo4n/dFoG3yYrospp3frKsDXxF1K2/MTCJWjpgnn7wc+HiPQWG0W3HRtQCNkyyrHes0YKcYyDWIP6kztYv1I/Me3p0pGEx6t3CpSTg1v46eRnOlDWiUz3rVxPauwq9IYZ75gmnThqvg/Z8wcYsWLx0arago0SXtRPASCNj4uO/lbqTcAfyIXOTSiOlcAIjoPFRSQY7UqY0o2p8jRR/1L16SmGDsk8ijm+UygNmMexa3Khy5WcKctpQICakHs4NRjHNflqgXpXKL9dVBmNc9d7h+gbhbGJQ53Y0d+a35UbhPRMiv4SRH98FwB+WEsLCDdGSHvdmM6ArfOLljTrqrsmSRf0JfUrvzyVYmMCxjv4xgJwUS/TD5lQD1yPwkp2ss00kQJqzNmB7qwFhA8a3e2iNzV8qtAV/Nj+tMlr99Hb7vZZs98/38G2p5RAsE/5Xl9taKhc/ACnVc/bwJND4JWaBB7duCa08xVB8nkjlt5cCwMurzAcy1ZT+e8JepR+g6s8fpScMEWVJXE0hd8=--rZ41rY9TMXmiBUJw--QiLRVNVXZzTW446s7cec1g== |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@ |
|||||||
|
class AddIncome2ValueCheck < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
add_column :sales_logs, :income2_value_check, :integer |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
class AddStaircasesaleToSalesLogs < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
add_column :sales_logs, :staircasesale, :integer |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
class AddEthnicFieldsForBuyer2 < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
change_table :sales_logs, bulk: true do |t| |
||||||
|
t.column :ethnic_group2, :integer |
||||||
|
t.column :ethnicbuy2, :integer |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
@ -0,0 +1,33 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundArab, type: :model do |
||||||
|
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||||
|
|
||||||
|
let(:page_id) { nil } |
||||||
|
let(:page_definition) { nil } |
||||||
|
let(:subsection) { instance_double(Form::Subsection) } |
||||||
|
|
||||||
|
it "has correct subsection" do |
||||||
|
expect(page.subsection).to eq(subsection) |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct questions" do |
||||||
|
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2]) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(page.id).to eq("buyer_2_ethnic_background_arab") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(page.header).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct description" do |
||||||
|
expect(page.description).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct depends_on" do |
||||||
|
expect(page.depends_on).to eq([{ "ethnic_group2" => 4 }]) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundAsian, type: :model do |
||||||
|
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||||
|
|
||||||
|
let(:page_id) { nil } |
||||||
|
let(:page_definition) { nil } |
||||||
|
let(:subsection) { instance_double(Form::Subsection) } |
||||||
|
|
||||||
|
it "has correct subsection" do |
||||||
|
expect(page.subsection).to eq(subsection) |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct questions" do |
||||||
|
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2]) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(page.id).to eq("buyer_2_ethnic_background_asian") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(page.header).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct description" do |
||||||
|
expect(page.description).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct depends_on" do |
||||||
|
expect(page.depends_on).to eq([{ "ethnic_group2" => 2 }]) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundBlack, type: :model do |
||||||
|
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||||
|
|
||||||
|
let(:page_id) { nil } |
||||||
|
let(:page_definition) { nil } |
||||||
|
let(:subsection) { instance_double(Form::Subsection) } |
||||||
|
|
||||||
|
it "has correct subsection" do |
||||||
|
expect(page.subsection).to eq(subsection) |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct questions" do |
||||||
|
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2]) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(page.id).to eq("buyer_2_ethnic_background_black") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(page.header).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct description" do |
||||||
|
expect(page.description).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct depends_on" do |
||||||
|
expect(page.depends_on).to eq([{ "ethnic_group2" => 3 }]) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundMixed, type: :model do |
||||||
|
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||||
|
|
||||||
|
let(:page_id) { nil } |
||||||
|
let(:page_definition) { nil } |
||||||
|
let(:subsection) { instance_double(Form::Subsection) } |
||||||
|
|
||||||
|
it "has correct subsection" do |
||||||
|
expect(page.subsection).to eq(subsection) |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct questions" do |
||||||
|
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2]) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(page.id).to eq("buyer_2_ethnic_background_mixed") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(page.header).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct description" do |
||||||
|
expect(page.description).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct depends_on" do |
||||||
|
expect(page.depends_on).to eq([{ "ethnic_group2" => 1 }]) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundWhite, type: :model do |
||||||
|
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||||
|
|
||||||
|
let(:page_id) { nil } |
||||||
|
let(:page_definition) { nil } |
||||||
|
let(:subsection) { instance_double(Form::Subsection) } |
||||||
|
|
||||||
|
it "has correct subsection" do |
||||||
|
expect(page.subsection).to eq(subsection) |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct questions" do |
||||||
|
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2]) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(page.id).to eq("buyer_2_ethnic_background_white") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(page.header).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct description" do |
||||||
|
expect(page.description).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct depends_on" do |
||||||
|
expect(page.depends_on).to eq([{ "ethnic_group2" => 0 }]) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,42 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Pages::Buyer2EthnicGroup, type: :model do |
||||||
|
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||||
|
|
||||||
|
let(:page_id) { nil } |
||||||
|
let(:page_definition) { nil } |
||||||
|
let(:subsection) { instance_double(Form::Subsection) } |
||||||
|
|
||||||
|
it "has correct subsection" do |
||||||
|
expect(page.subsection).to eq(subsection) |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct questions" do |
||||||
|
expect(page.questions.map(&:id)).to eq(%w[ethnic_group2]) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(page.id).to eq("buyer_2_ethnic_group") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(page.header).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct description" do |
||||||
|
expect(page.description).to be_nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct depends_on" do |
||||||
|
expect(page.depends_on).to eq([ |
||||||
|
{ |
||||||
|
"jointpur" => 1, |
||||||
|
"privacynotice" => 1, |
||||||
|
}, |
||||||
|
{ |
||||||
|
"jointpur" => 1, |
||||||
|
"noint" => 1, |
||||||
|
}, |
||||||
|
]) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,48 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundArab, type: :model do |
||||||
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||||
|
|
||||||
|
let(:question_id) { nil } |
||||||
|
let(:question_definition) { nil } |
||||||
|
let(:page) { instance_double(Form::Page) } |
||||||
|
|
||||||
|
it "has correct page" do |
||||||
|
expect(question.page).to eq(page) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(question.id).to eq("ethnicbuy2") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(question.header).to eq("Which of the following best describes the buyer 2’s Arab background?") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answer_label" do |
||||||
|
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct type" do |
||||||
|
expect(question.type).to eq("radio") |
||||||
|
end |
||||||
|
|
||||||
|
it "is not marked as derived" do |
||||||
|
expect(question.derived?).to be false |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct hint_text" do |
||||||
|
expect(question.hint_text).to be nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct answer_options" do |
||||||
|
expect(question.answer_options).to eq({ |
||||||
|
"16" => { "value" => "Other ethnic group" }, |
||||||
|
"19" => { "value" => "Arab" }, |
||||||
|
}) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answers_card_number" do |
||||||
|
expect(question.check_answers_card_number).to eq(2) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,51 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundAsian, type: :model do |
||||||
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||||
|
|
||||||
|
let(:question_id) { nil } |
||||||
|
let(:question_definition) { nil } |
||||||
|
let(:page) { instance_double(Form::Page) } |
||||||
|
|
||||||
|
it "has correct page" do |
||||||
|
expect(question.page).to eq(page) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(question.id).to eq("ethnicbuy2") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(question.header).to eq("Which of the following best describes the buyer 2’s Asian or Asian British background?") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answer_label" do |
||||||
|
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct type" do |
||||||
|
expect(question.type).to eq("radio") |
||||||
|
end |
||||||
|
|
||||||
|
it "is not marked as derived" do |
||||||
|
expect(question.derived?).to be false |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct hint_text" do |
||||||
|
expect(question.hint_text).to be nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct answer_options" do |
||||||
|
expect(question.answer_options).to eq({ |
||||||
|
"10" => { "value" => "Bangladeshi" }, |
||||||
|
"11" => { "value" => "Any other Asian or Asian British background" }, |
||||||
|
"15" => { "value" => "Chinese" }, |
||||||
|
"8" => { "value" => "Indian" }, |
||||||
|
"9" => { "value" => "Pakistani" }, |
||||||
|
}) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answers_card_number" do |
||||||
|
expect(question.check_answers_card_number).to eq(2) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,49 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundBlack, type: :model do |
||||||
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||||
|
|
||||||
|
let(:question_id) { nil } |
||||||
|
let(:question_definition) { nil } |
||||||
|
let(:page) { instance_double(Form::Page) } |
||||||
|
|
||||||
|
it "has correct page" do |
||||||
|
expect(question.page).to eq(page) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(question.id).to eq("ethnicbuy2") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(question.header).to eq("Which of the following best describes the buyer 2’s Black, African, Caribbean or Black British background?") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answer_label" do |
||||||
|
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct type" do |
||||||
|
expect(question.type).to eq("radio") |
||||||
|
end |
||||||
|
|
||||||
|
it "is not marked as derived" do |
||||||
|
expect(question.derived?).to be false |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct hint_text" do |
||||||
|
expect(question.hint_text).to be nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct answer_options" do |
||||||
|
expect(question.answer_options).to eq({ |
||||||
|
"12" => { "value" => "Caribbean" }, |
||||||
|
"13" => { "value" => "African" }, |
||||||
|
"14" => { "value" => "Any other Black, African or Caribbean background" }, |
||||||
|
}) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answers_card_number" do |
||||||
|
expect(question.check_answers_card_number).to eq(2) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,50 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundMixed, type: :model do |
||||||
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||||
|
|
||||||
|
let(:question_id) { nil } |
||||||
|
let(:question_definition) { nil } |
||||||
|
let(:page) { instance_double(Form::Page) } |
||||||
|
|
||||||
|
it "has correct page" do |
||||||
|
expect(question.page).to eq(page) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(question.id).to eq("ethnicbuy2") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(question.header).to eq("Which of the following best describes the buyer 2’s Mixed or Multiple ethnic groups background?") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answer_label" do |
||||||
|
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct type" do |
||||||
|
expect(question.type).to eq("radio") |
||||||
|
end |
||||||
|
|
||||||
|
it "is not marked as derived" do |
||||||
|
expect(question.derived?).to be false |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct hint_text" do |
||||||
|
expect(question.hint_text).to be nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct answer_options" do |
||||||
|
expect(question.answer_options).to eq({ |
||||||
|
"4" => { "value" => "White and Black Caribbean" }, |
||||||
|
"5" => { "value" => "White and Black African" }, |
||||||
|
"6" => { "value" => "White and Asian" }, |
||||||
|
"7" => { "value" => "Any other Mixed or Multiple ethnic background" }, |
||||||
|
}) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answers_card_number" do |
||||||
|
expect(question.check_answers_card_number).to eq(2) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,50 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundWhite, type: :model do |
||||||
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||||
|
|
||||||
|
let(:question_id) { nil } |
||||||
|
let(:question_definition) { nil } |
||||||
|
let(:page) { instance_double(Form::Page) } |
||||||
|
|
||||||
|
it "has correct page" do |
||||||
|
expect(question.page).to eq(page) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(question.id).to eq("ethnicbuy2") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(question.header).to eq("Which of the following best describes the buyer 2’s White background?") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answer_label" do |
||||||
|
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct type" do |
||||||
|
expect(question.type).to eq("radio") |
||||||
|
end |
||||||
|
|
||||||
|
it "is not marked as derived" do |
||||||
|
expect(question.derived?).to be false |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct hint_text" do |
||||||
|
expect(question.hint_text).to be nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct answer_options" do |
||||||
|
expect(question.answer_options).to eq({ |
||||||
|
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" }, |
||||||
|
"18" => { "value" => "Gypsy or Irish Traveller" }, |
||||||
|
"2" => { "value" => "Irish" }, |
||||||
|
"3" => { "value" => "Any other White background" }, |
||||||
|
}) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answers_card_number" do |
||||||
|
expect(question.check_answers_card_number).to eq(2) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,62 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Questions::Buyer2EthnicGroup, type: :model do |
||||||
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||||
|
|
||||||
|
let(:question_id) { nil } |
||||||
|
let(:question_definition) { nil } |
||||||
|
let(:page) { instance_double(Form::Page) } |
||||||
|
|
||||||
|
it "has correct page" do |
||||||
|
expect(question.page).to eq(page) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(question.id).to eq("ethnic_group2") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(question.header).to eq("What is buyer 2’s ethnic group?") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answer_label" do |
||||||
|
expect(question.check_answer_label).to eq("Buyer 2’s ethnic group") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct type" do |
||||||
|
expect(question.type).to eq("radio") |
||||||
|
end |
||||||
|
|
||||||
|
it "is not marked as derived" do |
||||||
|
expect(question.derived?).to be false |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct hint_text" do |
||||||
|
expect(question.hint_text).to be nil |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct answer_options" do |
||||||
|
expect(question.answer_options).to eq({ |
||||||
|
"0" => { "value" => "White" }, |
||||||
|
"1" => { "value" => "Mixed or Multiple ethnic groups" }, |
||||||
|
"17" => { "value" => "Buyer 1 prefers not to say" }, |
||||||
|
"2" => { "value" => "Asian or Asian British" }, |
||||||
|
"3" => { "value" => "Black, African, Caribbean or Black British" }, |
||||||
|
"4" => { "value" => "Arab or other ethnic group" }, |
||||||
|
"divider" => { "value" => true }, |
||||||
|
}) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answers_card_number" do |
||||||
|
expect(question.check_answers_card_number).to eq(2) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct inferred_check_answers_value" do |
||||||
|
expect(question.inferred_check_answers_value).to eq([{ |
||||||
|
"condition" => { |
||||||
|
"ethnic_group2" => 17, |
||||||
|
}, |
||||||
|
"value" => "Prefers not to say", |
||||||
|
}]) |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,49 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Questions::StaircaseSale, type: :model do |
||||||
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||||
|
|
||||||
|
let(:question_id) { nil } |
||||||
|
let(:question_definition) { nil } |
||||||
|
let(:page) { instance_double(Form::Page) } |
||||||
|
|
||||||
|
it "has correct page" do |
||||||
|
expect(question.page).to eq(page) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(question.id).to eq("staircasesale") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(question.header).to eq("Is this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answer_label" do |
||||||
|
expect(question.check_answer_label).to eq("Part of a back-to-back staircasing transaction") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct type" do |
||||||
|
expect(question.type).to eq("radio") |
||||||
|
end |
||||||
|
|
||||||
|
it "is not marked as derived" do |
||||||
|
expect(question.derived?).to be false |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct answer_options" do |
||||||
|
expect(question.answer_options).to eq({ |
||||||
|
"1" => { "value" => "Yes" }, |
||||||
|
"2" => { "value" => "No" }, |
||||||
|
"3" => { "value" => "Don't know" }, |
||||||
|
}) |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct conditional for" do |
||||||
|
expect(question.conditional_for).to eq(nil) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct hint" do |
||||||
|
expect(question.hint_text).to be_nil |
||||||
|
end |
||||||
|
end |
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue