60 changed files with 1214 additions and 384 deletions
@ -0,0 +1,17 @@
|
||||
class Form::Sales::Pages::BuildingHeightClass < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "building_height_class" |
||||
@depends_on = [ |
||||
{ "proptype" => 1 }, |
||||
{ "proptype" => 2 }, |
||||
{ "proptype" => 9 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::BuildingHeightClass.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
||||
@ -0,0 +1,13 @@
|
||||
class Form::Sales::Pages::ServiceChargeStaircasing < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@copy_key = "sales.sale_information.servicecharges" |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::HasServiceCharge.new(nil, nil, self, staircasing: true), |
||||
Form::Sales::Questions::ServiceCharge.new(nil, nil, self, staircasing: true), |
||||
] |
||||
end |
||||
end |
||||
@ -0,0 +1,17 @@
|
||||
class Form::Sales::Questions::BuildingHeightClass < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "buildheightclass" |
||||
@type = "radio" |
||||
@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 |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"1" => { "value" => "High-rise" }, |
||||
"2" => { "value" => "Low-rise" }, |
||||
"3" => { "value" => "Don't know" }, |
||||
}.freeze |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2026 => 17 }.freeze |
||||
end |
||||
@ -1,16 +1,24 @@
|
||||
class Form::Sales::Questions::ServiceCharge < ::Form::Question |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
def initialize(id, hsh, subsection, staircasing:) |
||||
super(id, hsh, subsection) |
||||
@id = "mscharge" |
||||
@type = "numeric" |
||||
@min = 1 |
||||
@max = 9999.99 |
||||
@step = 0.01 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
@copy_key = "sales.sale_information.servicecharges.servicecharge" |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||
@staircasing = staircasing |
||||
@question_number = question_number_from_year[form.start_date.year] || question_number_from_year[question_number_from_year.keys.max] |
||||
@strip_commas = true |
||||
end |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2025 => 88 }.freeze |
||||
def question_number_from_year |
||||
if @staircasing |
||||
{ 2026 => 0 }.freeze |
||||
else |
||||
{ 2025 => 88, 2026 => 0 }.freeze |
||||
end |
||||
end |
||||
end |
||||
|
||||
@ -0,0 +1,5 @@
|
||||
class AddBuildheightclassToSalesLogs < ActiveRecord::Migration[7.2] |
||||
def change |
||||
add_column :sales_logs, :buildheightclass, :integer |
||||
end |
||||
end |
||||
@ -0,0 +1,25 @@
|
||||
class AddCompositeIndexesForLogsOrganisationLookup < ActiveRecord::Migration[7.2] |
||||
disable_ddl_transaction! |
||||
|
||||
def change |
||||
add_index :lettings_logs, %i[owning_organisation_id id], |
||||
order: { id: :desc }, |
||||
name: "index_lettings_logs_on_owning_org_and_id_desc", |
||||
algorithm: :concurrently |
||||
|
||||
add_index :lettings_logs, %i[managing_organisation_id id], |
||||
order: { id: :desc }, |
||||
name: "index_lettings_logs_on_managing_org_and_id_desc", |
||||
algorithm: :concurrently |
||||
|
||||
add_index :sales_logs, %i[owning_organisation_id id], |
||||
order: { id: :desc }, |
||||
name: "index_sales_logs_on_owning_org_and_id_desc", |
||||
algorithm: :concurrently |
||||
|
||||
add_index :sales_logs, %i[managing_organisation_id id], |
||||
order: { id: :desc }, |
||||
name: "index_sales_logs_on_managing_org_and_id_desc", |
||||
algorithm: :concurrently |
||||
end |
||||
end |
||||
@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<forms> |
||||
<form> |
||||
<ID>{id}</ID> |
||||
<STATUS>1</STATUS> |
||||
<PURCHID>123</PURCHID> |
||||
<TYPE>8</TYPE> |
||||
<JOINTMORE>1</JOINTMORE> |
||||
<BEDS>2</BEDS> |
||||
<AGE1>27</AGE1> |
||||
<SEX1>F</SEX1> |
||||
<ETHNIC>17</ETHNIC> |
||||
<BUILTYPE>1</BUILTYPE> |
||||
<PROPTYPE>1</PROPTYPE> |
||||
<AGE2>33</AGE2> |
||||
<RELAT2>P</RELAT2> |
||||
<SEX2>X</SEX2> |
||||
<NOINT>2</NOINT> |
||||
<ECSTAT2>1</ECSTAT2> |
||||
<PRIVACYNOTICE>1</PRIVACYNOTICE> |
||||
<ECSTAT1>1</ECSTAT1> |
||||
<WHEEL>1</WHEEL> |
||||
<HHOLDCOUNT>4</HHOLDCOUNT> |
||||
<AGE3>14</AGE3> |
||||
<LA>E09000033</LA> |
||||
<INCOME1>10000</INCOME1> |
||||
<AGE4>18</AGE4> |
||||
<AGE5>40</AGE5> |
||||
<AGE6>40</AGE6> |
||||
<INC1MORT>1</INC1MORT> |
||||
<INCOME2>10000</INCOME2> |
||||
<SAVINGSNK>1</SAVINGSNK> |
||||
<SAVINGS/> |
||||
<PREVOWN>1</PREVOWN> |
||||
<SEX3>F</SEX3> |
||||
<MORTGAGE>20000.0</MORTGAGE> |
||||
<INC2MORT>1</INC2MORT> |
||||
<ECSTAT3>9</ECSTAT3> |
||||
<ECSTAT4>3</ECSTAT4> |
||||
<ECSTAT5>2</ECSTAT5> |
||||
<ECSTAT6>1</ECSTAT6> |
||||
<RELAT3>X</RELAT3> |
||||
<RELAT4>X</RELAT4> |
||||
<RELAT5>R</RELAT5> |
||||
<RELAT6>R</RELAT6> |
||||
<HB>4</HB> |
||||
<SEX4>X</SEX4> |
||||
<SEX5>M</SEX5> |
||||
<SEX6>X</SEX6> |
||||
<FROMBEDS/> |
||||
<STAIRCASE/> |
||||
<STAIRBOUGHT/> |
||||
<STAIROWNED/> |
||||
<MRENT/> |
||||
<RESALE/> |
||||
<DEPOSIT>80000.0</DEPOSIT> |
||||
<CASHDIS/> |
||||
<DISABLED>1</DISABLED> |
||||
<VALUE>110000.0</VALUE> |
||||
<EQUITY/> |
||||
<DISCOUNT/> |
||||
<GRANT>10000.0</GRANT> |
||||
<PPCODENK>0</PPCODENK> |
||||
<PPOSTC1>SW1A</PPOSTC1> |
||||
<PPOSTC2>1AA</PPOSTC2> |
||||
<PREVLOC>E09000033</PREVLOC> |
||||
<HHREGRES>7</HHREGRES> |
||||
<HHREGRESSTILL/> |
||||
<PROPLEN/> |
||||
<MSCHARGE>100.0</MSCHARGE> |
||||
<PREVTEN>1</PREVTEN> |
||||
<MORTGAGEUSED>1</MORTGAGEUSED> |
||||
<WCHAIR>1</WCHAIR> |
||||
<ARMEDFORCESSPOUSE>5</ARMEDFORCESSPOUSE> |
||||
<HODAY/> |
||||
<HOMONTH/> |
||||
<HOYEAR/> |
||||
<FROMPROP/> |
||||
<SOCPREVTEN/> |
||||
<EXTRABOR>1</EXTRABOR> |
||||
<HHTYPE>6</HHTYPE> |
||||
<VALUE_VALUE_CHECK/> |
||||
<PREVSHARED>2</PREVSHARED> |
||||
<BUY2LIVING>3</BUY2LIVING> |
||||
<UPRN/> |
||||
<COUNTY/> |
||||
<ADDRESS_SEARCH_VALUE_CHECK/> |
||||
<FIRSTSTAIR/> |
||||
<NUMSTAIR/> |
||||
<MRENTPRESTAIRCASING/> |
||||
<DAY>1</DAY> |
||||
<MONTH>4</MONTH> |
||||
<YEAR>2025</YEAR> |
||||
<CREATEDDATE>2025-04-01T00:00:00+01:00</CREATEDDATE> |
||||
<CREATEDBY>{created_by_email}</CREATEDBY> |
||||
<CREATEDBYID>{created_by_id}</CREATEDBYID> |
||||
<USERNAME>{assigned_to_email}</USERNAME> |
||||
<USERNAMEID>{assigned_to_id}</USERNAMEID> |
||||
<UPLOADDATE>2025-04-01T00:00:00+01:00</UPLOADDATE> |
||||
<AMENDEDBY/> |
||||
<AMENDEDBYID/> |
||||
<OWNINGORGID>{owning_org_id}</OWNINGORGID> |
||||
<OWNINGORGNAME>{owning_org_name}</OWNINGORGNAME> |
||||
<MANINGORGID>{managing_org_id}</MANINGORGID> |
||||
<MANINGORGNAME>{managing_org_name}</MANINGORGNAME> |
||||
<CREATIONMETHOD>1</CREATIONMETHOD> |
||||
<BULKUPLOADID/> |
||||
<COLLECTIONYEAR>2025</COLLECTIONYEAR> |
||||
<OWNERSHIP>2</OWNERSHIP> |
||||
<JOINT>1</JOINT> |
||||
<ETHNICGROUP1>17</ETHNICGROUP1> |
||||
<ETHNICGROUP2>17</ETHNICGROUP2> |
||||
<PREVIOUSLAKNOWN>1</PREVIOUSLAKNOWN> |
||||
<HASMSCHARGE>1</HASMSCHARGE> |
||||
<HASSERVICECHARGES/> |
||||
<SERVICECHARGES/> |
||||
<INC1NK>0</INC1NK> |
||||
<INC2NK>0</INC2NK> |
||||
<POSTCODE>SW1A 1AA</POSTCODE> |
||||
<ISLAINFERRED>true</ISLAINFERRED> |
||||
<MORTLEN1>10</MORTLEN1> |
||||
<ETHNIC2/> |
||||
<PREVTEN2/> |
||||
<ADDRESS1>Address line 1</ADDRESS1> |
||||
<ADDRESS2/> |
||||
<TOWNCITY>City</TOWNCITY> |
||||
<LANAME>Westminster</LANAME> |
||||
<ADDRESS1INPUT>Address line 1</ADDRESS1INPUT> |
||||
<POSTCODEINPUT>SW1A 1AA</POSTCODEINPUT> |
||||
<UPRNSELECTED/> |
||||
<BULKADDRESS1/> |
||||
<BULKADDRESS2/> |
||||
<BULKTOWNCITY/> |
||||
<BULKCOUNTY/> |
||||
<BULKPOSTCODE/> |
||||
<BULKLA/> |
||||
<NATIONALITYALL1>826</NATIONALITYALL1> |
||||
<NATIONALITYALL2>826</NATIONALITYALL2> |
||||
<PREVLOCNAME>Westminster</PREVLOCNAME> |
||||
<LIVEINBUYER1>1</LIVEINBUYER1> |
||||
<LIVEINBUYER2>1</LIVEINBUYER2> |
||||
<HASESTATEFEE/> |
||||
<ESTATEFEE/> |
||||
<STAIRLASTDAY/> |
||||
<STAIRLASTMONTH/> |
||||
<STAIRLASTYEAR/> |
||||
<STAIRINITIALDAY/> |
||||
<STAIRINITIALMONTH/> |
||||
<STAIRINITIALYEAR/> |
||||
<MSCHARGE_VALUE_CHECK/> |
||||
<DUPLICATESET/> |
||||
<STAIRCASETOSALE/> |
||||
</form> |
||||
</forms> |
||||
@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<forms> |
||||
<form> |
||||
<ID>{id}</ID> |
||||
<STATUS>1</STATUS> |
||||
<PURCHID>123</PURCHID> |
||||
<TYPE>8</TYPE> |
||||
<JOINTMORE>1</JOINTMORE> |
||||
<BEDS>2</BEDS> |
||||
<AGE1>27</AGE1> |
||||
<SEXRAB1>F</SEXRAB1> |
||||
<ETHNIC>17</ETHNIC> |
||||
<BUILTYPE>1</BUILTYPE> |
||||
<PROPTYPE>1</PROPTYPE> |
||||
<AGE2>33</AGE2> |
||||
<RELAT2>P</RELAT2> |
||||
<SEXRAB2>R</SEXRAB2> |
||||
<NOINT>2</NOINT> |
||||
<ECSTAT2>1</ECSTAT2> |
||||
<PRIVACYNOTICE>1</PRIVACYNOTICE> |
||||
<ECSTAT1>1</ECSTAT1> |
||||
<WHEEL>1</WHEEL> |
||||
<HHOLDCOUNT>4</HHOLDCOUNT> |
||||
<AGE3>14</AGE3> |
||||
<LA>E09000033</LA> |
||||
<INCOME1>10000</INCOME1> |
||||
<AGE4>18</AGE4> |
||||
<AGE5>40</AGE5> |
||||
<AGE6>40</AGE6> |
||||
<INC1MORT>1</INC1MORT> |
||||
<INCOME2>10000</INCOME2> |
||||
<SAVINGSNK>1</SAVINGSNK> |
||||
<SAVINGS/> |
||||
<PREVOWN>1</PREVOWN> |
||||
<SEXRAB3>F</SEXRAB3> |
||||
<MORTGAGE>20000.0</MORTGAGE> |
||||
<INC2MORT>1</INC2MORT> |
||||
<ECSTAT3>9</ECSTAT3> |
||||
<ECSTAT4>3</ECSTAT4> |
||||
<ECSTAT5>2</ECSTAT5> |
||||
<ECSTAT6>1</ECSTAT6> |
||||
<RELAT3>X</RELAT3> |
||||
<RELAT4>X</RELAT4> |
||||
<RELAT5>R</RELAT5> |
||||
<RELAT6>R</RELAT6> |
||||
<HB>4</HB> |
||||
<SEXRAB4>R</SEXRAB4> |
||||
<SEXRAB5>M</SEXRAB5> |
||||
<SEXRAB6>R</SEXRAB6> |
||||
<FROMBEDS/> |
||||
<STAIRCASE/> |
||||
<STAIRBOUGHT/> |
||||
<STAIROWNED/> |
||||
<MRENT/> |
||||
<RESALE/> |
||||
<DEPOSIT>80000.0</DEPOSIT> |
||||
<CASHDIS/> |
||||
<DISABLED>1</DISABLED> |
||||
<VALUE>110000.0</VALUE> |
||||
<EQUITY/> |
||||
<DISCOUNT/> |
||||
<GRANT>10000.0</GRANT> |
||||
<PPCODENK>0</PPCODENK> |
||||
<PPOSTC1>SW1A</PPOSTC1> |
||||
<PPOSTC2>1AA</PPOSTC2> |
||||
<PREVLOC>E09000033</PREVLOC> |
||||
<HHREGRES>7</HHREGRES> |
||||
<HHREGRESSTILL/> |
||||
<PROPLEN/> |
||||
<MSCHARGE>100.0</MSCHARGE> |
||||
<PREVTEN>1</PREVTEN> |
||||
<MORTGAGEUSED>1</MORTGAGEUSED> |
||||
<WCHAIR>1</WCHAIR> |
||||
<ARMEDFORCESSPOUSE>5</ARMEDFORCESSPOUSE> |
||||
<HODAY/> |
||||
<HOMONTH/> |
||||
<HOYEAR/> |
||||
<FROMPROP/> |
||||
<SOCPREVTEN/> |
||||
<EXTRABOR>1</EXTRABOR> |
||||
<HHTYPE>6</HHTYPE> |
||||
<VALUE_VALUE_CHECK/> |
||||
<PREVSHARED>2</PREVSHARED> |
||||
<BUY2LIVING>3</BUY2LIVING> |
||||
<UPRN/> |
||||
<COUNTY/> |
||||
<ADDRESS_SEARCH_VALUE_CHECK/> |
||||
<FIRSTSTAIR/> |
||||
<NUMSTAIR/> |
||||
<MRENTPRESTAIRCASING/> |
||||
<BUILDHEIGHTCLASS>2</BUILDHEIGHTCLASS> |
||||
<DAY>1</DAY> |
||||
<MONTH>4</MONTH> |
||||
<YEAR>2026</YEAR> |
||||
<CREATEDDATE>2026-04-01T00:00:00+01:00</CREATEDDATE> |
||||
<CREATEDBY>{created_by_email}</CREATEDBY> |
||||
<CREATEDBYID>{created_by_id}</CREATEDBYID> |
||||
<USERNAME>{assigned_to_email}</USERNAME> |
||||
<USERNAMEID>{assigned_to_id}</USERNAMEID> |
||||
<UPLOADDATE>2026-04-01T00:00:00+01:00</UPLOADDATE> |
||||
<AMENDEDBY/> |
||||
<AMENDEDBYID/> |
||||
<OWNINGORGID>{owning_org_id}</OWNINGORGID> |
||||
<OWNINGORGNAME>{owning_org_name}</OWNINGORGNAME> |
||||
<MANINGORGID>{managing_org_id}</MANINGORGID> |
||||
<MANINGORGNAME>{managing_org_name}</MANINGORGNAME> |
||||
<CREATIONMETHOD>1</CREATIONMETHOD> |
||||
<BULKUPLOADID/> |
||||
<COLLECTIONYEAR>2026</COLLECTIONYEAR> |
||||
<OWNERSHIP>2</OWNERSHIP> |
||||
<JOINT>1</JOINT> |
||||
<ETHNICGROUP1>17</ETHNICGROUP1> |
||||
<ETHNICGROUP2>17</ETHNICGROUP2> |
||||
<PREVIOUSLAKNOWN>1</PREVIOUSLAKNOWN> |
||||
<HASMSCHARGE>1</HASMSCHARGE> |
||||
<HASSERVICECHARGES/> |
||||
<SERVICECHARGES/> |
||||
<INC1NK>0</INC1NK> |
||||
<INC2NK>0</INC2NK> |
||||
<POSTCODE>SW1A 1AA</POSTCODE> |
||||
<ISLAINFERRED>true</ISLAINFERRED> |
||||
<MORTLEN1>10</MORTLEN1> |
||||
<ETHNIC2/> |
||||
<PREVTEN2/> |
||||
<ADDRESS1>Address line 1</ADDRESS1> |
||||
<ADDRESS2/> |
||||
<TOWNCITY>City</TOWNCITY> |
||||
<LANAME>Westminster</LANAME> |
||||
<ADDRESS1INPUT>Address line 1</ADDRESS1INPUT> |
||||
<POSTCODEINPUT>SW1A 1AA</POSTCODEINPUT> |
||||
<UPRNSELECTED/> |
||||
<BULKADDRESS1/> |
||||
<BULKADDRESS2/> |
||||
<BULKTOWNCITY/> |
||||
<BULKCOUNTY/> |
||||
<BULKPOSTCODE/> |
||||
<BULKLA/> |
||||
<NATIONALITYALL1>826</NATIONALITYALL1> |
||||
<NATIONALITYALL2>826</NATIONALITYALL2> |
||||
<PREVLOCNAME>Westminster</PREVLOCNAME> |
||||
<LIVEINBUYER1>1</LIVEINBUYER1> |
||||
<LIVEINBUYER2>1</LIVEINBUYER2> |
||||
<HASESTATEFEE/> |
||||
<ESTATEFEE/> |
||||
<STAIRLASTDAY/> |
||||
<STAIRLASTMONTH/> |
||||
<STAIRLASTYEAR/> |
||||
<STAIRINITIALDAY/> |
||||
<STAIRINITIALMONTH/> |
||||
<STAIRINITIALYEAR/> |
||||
<MSCHARGE_VALUE_CHECK/> |
||||
<DUPLICATESET/> |
||||
<STAIRCASETOSALE/> |
||||
</form> |
||||
</forms> |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,36 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::BuildingHeightClass, type: :model do |
||||
include CollectionTimeHelper |
||||
|
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: current_collection_start_date)) } |
||||
let(:sales_log) { FactoryBot.create(:sales_log, :completed) } |
||||
|
||||
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[buildheightclass]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("building_height_class") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to be_nil |
||||
end |
||||
|
||||
it "has the correct depends_on" do |
||||
expect(page.depends_on).to eq([ |
||||
{ "proptype" => 1 }, |
||||
{ "proptype" => 2 }, |
||||
{ "proptype" => 9 }, |
||||
]) |
||||
end |
||||
end |
||||
@ -0,0 +1,29 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::ServiceChargeStaircasing, 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, form: instance_double(Form, start_date: Time.zone.local(2026, 4, 1))) } |
||||
|
||||
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[has_mscharge mscharge]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).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 be_nil |
||||
end |
||||
end |
||||
@ -0,0 +1,39 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::BuildingHeightClass, type: :model do |
||||
include CollectionTimeHelper |
||||
|
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
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: current_collection_start_date))) } |
||||
|
||||
it "has correct page" do |
||||
expect(question.page).to eq(page) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("buildheightclass") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("radio") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(nil)).to be false |
||||
end |
||||
|
||||
it "has the correct answer_options" do |
||||
expect(question.answer_options).to eq({ |
||||
"1" => { "value" => "High-rise" }, |
||||
"2" => { "value" => "Low-rise" }, |
||||
"3" => { "value" => "Don't know" }, |
||||
}) |
||||
end |
||||
|
||||
it "has the correct question_number" do |
||||
expect(question.question_number).to eq(17) |
||||
end |
||||
end |
||||
@ -0,0 +1,85 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Subsections::SharedOwnershipStaircasingTransaction, type: :model do |
||||
subject(:shared_ownership_staircasing_transaction) { described_class.new(nil, nil, section) } |
||||
|
||||
let(:form) { instance_double(Form, start_year_2026_or_later?: false) } |
||||
let(:section) { instance_double(Form::Sales::Sections::SaleInformation, form:) } |
||||
|
||||
it "has correct section" do |
||||
expect(shared_ownership_staircasing_transaction.section).to eq(section) |
||||
end |
||||
|
||||
it "has the correct depends_on" do |
||||
expect(shared_ownership_staircasing_transaction.depends_on).to eq([{ "ownershipsch" => 1, "setup_completed?" => true, "staircase" => 1 }]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(shared_ownership_staircasing_transaction.id).to eq("shared_ownership_staircasing_transaction") |
||||
end |
||||
|
||||
it "has the correct label" do |
||||
expect(shared_ownership_staircasing_transaction.label).to eq("Shared ownership - staircasing transaction") |
||||
end |
||||
|
||||
it "has the correct copy key" do |
||||
expect(shared_ownership_staircasing_transaction.copy_key).to eq("sale_information") |
||||
end |
||||
|
||||
context "when the start year is 2025" do |
||||
let(:form) { instance_double(Form, start_year_2025_or_later?: true, start_year_2026_or_later?: false, start_date: Time.utc(2025, 4, 1)) } |
||||
|
||||
it "has correct pages" do |
||||
expect(shared_ownership_staircasing_transaction.pages.map(&:id)).to eq( |
||||
%w[ |
||||
about_staircasing_joint_purchase |
||||
about_staircasing_not_joint_purchase |
||||
staircase_sale |
||||
staircase_bought_value_check |
||||
staircase_owned_value_check_joint_purchase |
||||
staircase_owned_value_check_not_joint_purchase |
||||
staircase_first_time |
||||
staircase_previous |
||||
staircase_initial_date |
||||
value_shared_ownership_staircase |
||||
about_price_shared_ownership_value_check_staircasing |
||||
staircase_equity |
||||
shared_ownership_equity_value_check_staircasing |
||||
staircase_mortgage_used_shared_ownership |
||||
monthly_rent_staircasing_owned |
||||
monthly_rent_staircasing |
||||
monthly_charges_shared_ownership_value_check |
||||
], |
||||
) |
||||
end |
||||
end |
||||
|
||||
context "when the start year is 2026" do |
||||
let(:form) { instance_double(Form, start_year_2025_or_later?: true, start_year_2026_or_later?: true, start_date: Time.utc(2026, 4, 1)) } |
||||
|
||||
it "has correct pages" do |
||||
expect(shared_ownership_staircasing_transaction.pages.map(&:id)).to eq( |
||||
%w[ |
||||
about_staircasing_joint_purchase |
||||
about_staircasing_not_joint_purchase |
||||
staircase_sale |
||||
staircase_bought_value_check |
||||
staircase_owned_value_check_joint_purchase |
||||
staircase_owned_value_check_not_joint_purchase |
||||
staircase_first_time |
||||
staircase_previous |
||||
staircase_initial_date |
||||
value_shared_ownership_staircase |
||||
about_price_shared_ownership_value_check_staircasing |
||||
staircase_equity |
||||
shared_ownership_equity_value_check_staircasing |
||||
staircase_mortgage_used_shared_ownership |
||||
monthly_rent_staircasing_owned |
||||
monthly_rent_staircasing |
||||
service_charge_staircasing |
||||
monthly_charges_shared_ownership_value_check |
||||
], |
||||
) |
||||
end |
||||
end |
||||
end |
||||
Loading…
Reference in new issue