Browse Source

Cover lettings sections and subsections wiht tests

pull/1254/head
Kat 3 years ago
parent
commit
8cf8769510
  1. 29
      spec/models/form/lettings/sections/household_spec.rb
  2. 29
      spec/models/form/lettings/sections/rent_and_charges_spec.rb
  3. 29
      spec/models/form/lettings/sections/tenancy_and_property_spec.rb
  4. 131
      spec/models/form/lettings/subsections/household_characteristics_spec.rb
  5. 44
      spec/models/form/lettings/subsections/household_needs_spec.rb
  6. 50
      spec/models/form/lettings/subsections/household_situation_spec.rb
  7. 53
      spec/models/form/lettings/subsections/income_and_benefits_spec.rb
  8. 51
      spec/models/form/lettings/subsections/property_information_spec.rb
  9. 35
      spec/models/form/lettings/subsections/tenancy_information_spec.rb

29
spec/models/form/lettings/sections/household_spec.rb

@ -0,0 +1,29 @@
require "rails_helper"
RSpec.describe Form::Lettings::Sections::Household, type: :model do
subject(:household) { described_class.new(section_id, section_definition, form) }
let(:section_id) { nil }
let(:section_definition) { nil }
let(:form) { instance_double(Form) }
it "has correct form" do
expect(household.form).to eq(form)
end
it "has correct subsections" do
expect(household.subsections.map(&:id)).to eq(%w[household_characteristics household_needs household_situation])
end
it "has the correct id" do
expect(household.id).to eq("household")
end
it "has the correct label" do
expect(household.label).to eq("About the household")
end
it "has the correct description" do
expect(household.description).to be nil
end
end

29
spec/models/form/lettings/sections/rent_and_charges_spec.rb

@ -0,0 +1,29 @@
require "rails_helper"
RSpec.describe Form::Lettings::Sections::RentAndCharges, type: :model do
subject(:rent_and_charges) { described_class.new(section_id, section_definition, form) }
let(:section_id) { nil }
let(:section_definition) { nil }
let(:form) { instance_double(Form) }
it "has correct form" do
expect(rent_and_charges.form).to eq(form)
end
it "has correct subsections" do
expect(rent_and_charges.subsections.map(&:id)).to eq(%w[income_and_benefits])
end
it "has the correct id" do
expect(rent_and_charges.id).to eq("rent_and_charges")
end
it "has the correct label" do
expect(rent_and_charges.label).to eq("Finances")
end
it "has the correct description" do
expect(rent_and_charges.description).to be nil
end
end

29
spec/models/form/lettings/sections/tenancy_and_property_spec.rb

@ -0,0 +1,29 @@
require "rails_helper"
RSpec.describe Form::Lettings::Sections::TenancyAndProperty, type: :model do
subject(:tenancy_and_property) { described_class.new(section_id, section_definition, form) }
let(:section_id) { nil }
let(:section_definition) { nil }
let(:form) { instance_double(Form) }
it "has correct form" do
expect(tenancy_and_property.form).to eq(form)
end
it "has correct subsections" do
expect(tenancy_and_property.subsections.map(&:id)).to eq(%w[property_information tenancy_information])
end
it "has the correct id" do
expect(tenancy_and_property.id).to eq("tenancy_and_property")
end
it "has the correct label" do
expect(tenancy_and_property.label).to eq("Property and tenancy information")
end
it "has the correct description" do
expect(tenancy_and_property.description).to be nil
end
end

131
spec/models/form/lettings/subsections/household_characteristics_spec.rb

@ -0,0 +1,131 @@
require "rails_helper"
RSpec.describe Form::Lettings::Subsections::HouseholdCharacteristics, type: :model do
subject(:household_characteristics) { described_class.new(subsection_id, subsection_definition, section) }
let(:subsection_id) { nil }
let(:subsection_definition) { nil }
let(:section) { instance_double(Form::Lettings::Sections::Household) }
it "has correct section" do
expect(household_characteristics.section).to eq(section)
end
it "has correct pages" do
expect(household_characteristics.pages.map(&:id)).to eq(
%w[declaration
household_members
no_females_pregnant_household_lead_hhmemb_value_check
females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check
lead_tenant_age
no_females_pregnant_household_lead_age_value_check
females_in_soft_age_range_in_pregnant_household_lead_age_value_check
lead_tenant_gender_identity
no_females_pregnant_household_lead_value_check
females_in_soft_age_range_in_pregnant_household_lead_value_check
lead_tenant_ethnic_group
lead_tenant_ethnic_background_arab
lead_tenant_ethnic_background_asian
lead_tenant_ethnic_background_black
lead_tenant_ethnic_background_mixed
lead_tenant_ethnic_background_white
lead_tenant_nationality
lead_tenant_working_situation
lead_tenant_under_retirement_value_check
lead_tenant_over_retirement_value_check
person_2_known
person_2_relationship_to_lead
person_2_age
no_females_pregnant_household_person_2_age_value_check
females_in_soft_age_range_in_pregnant_household_person_2_age_value_check
person_2_gender_identity
no_females_pregnant_household_person_2_value_check
females_in_soft_age_range_in_pregnant_household_person_2_value_check
person_2_working_situation
person_2_under_retirement_value_check
person_2_over_retirement_value_check
person_3_known
person_3_relationship_to_lead
person_3_age
no_females_pregnant_household_person_3_age_value_check
females_in_soft_age_range_in_pregnant_household_person_3_age_value_check
person_3_gender_identity
no_females_pregnant_household_person_3_value_check
females_in_soft_age_range_in_pregnant_household_person_3_value_check
person_3_working_situation
person_3_under_retirement_value_check
person_3_over_retirement_value_check
person_4_known
person_4_relationship_to_lead
person_4_age
no_females_pregnant_household_person_4_age_value_check
females_in_soft_age_range_in_pregnant_household_person_4_age_value_check
person_4_gender_identity
no_females_pregnant_household_person_4_value_check
females_in_soft_age_range_in_pregnant_household_person_4_value_check
person_4_working_situation
person_4_under_retirement_value_check
person_4_over_retirement_value_check
person_5_known
person_5_relationship_to_lead
person_5_age
no_females_pregnant_household_person_5_age_value_check
females_in_soft_age_range_in_pregnant_household_person_5_age_value_check
person_5_gender_identity
no_females_pregnant_household_person_5_value_check
females_in_soft_age_range_in_pregnant_household_person_5_value_check
person_5_working_situation
person_5_under_retirement_value_check
person_5_over_retirement_value_check
person_6_known
person_6_relationship_to_lead
person_6_age
no_females_pregnant_household_person_6_age_value_check
females_in_soft_age_range_in_pregnant_household_person_6_age_value_check
person_6_gender_identity
no_females_pregnant_household_person_6_value_check
females_in_soft_age_range_in_pregnant_household_person_6_value_check
person_6_working_situation
person_6_under_retirement_value_check
person_6_over_retirement_value_check
person_7_known
person_7_relationship_to_lead
person_7_age
no_females_pregnant_household_person_7_age_value_check
females_in_soft_age_range_in_pregnant_household_person_7_age_value_check
person_7_gender_identity
no_females_pregnant_household_person_7_value_check
females_in_soft_age_range_in_pregnant_household_person_7_value_check
person_7_working_situation
person_7_under_retirement_value_check
person_7_over_retirement_value_check
person_8_known
person_8_relationship_to_lead
person_8_age
no_females_pregnant_household_person_8_age_value_check
females_in_soft_age_range_in_pregnant_household_person_8_age_value_check
person_8_gender_identity
no_females_pregnant_household_person_8_value_check
females_in_soft_age_range_in_pregnant_household_person_8_value_check
person_8_working_situation
person_8_under_retirement_value_check
person_8_over_retirement_value_check],
)
end
it "has the correct id" do
expect(household_characteristics.id).to eq("household_characteristics")
end
it "has the correct label" do
expect(household_characteristics.label).to eq("Household characteristics")
end
it "has the correct depends_on" do
expect(household_characteristics.depends_on).to eq([
{
"non_location_setup_questions_completed?" => true,
},
])
end
end

44
spec/models/form/lettings/subsections/household_needs_spec.rb

@ -0,0 +1,44 @@
require "rails_helper"
RSpec.describe Form::Lettings::Subsections::HouseholdNeeds, type: :model do
subject(:household_needs) { described_class.new(subsection_id, subsection_definition, section) }
let(:subsection_id) { nil }
let(:subsection_definition) { nil }
let(:section) { instance_double(Form::Lettings::Sections::Household) }
it "has correct section" do
expect(household_needs.section).to eq(section)
end
it "has correct pages" do
expect(household_needs.pages.map(&:id)).to eq(
%w[armed_forces
armed_forces_serving
armed_forces_injured
pregnant
no_females_pregnant_household_value_check
females_in_soft_age_range_in_pregnant_household_value_check
access_needs_exist
type_of_access_needs
health_conditions
health_condition_effects],
)
end
it "has the correct id" do
expect(household_needs.id).to eq("household_needs")
end
it "has the correct label" do
expect(household_needs.label).to eq("Household needs")
end
it "has the correct depends_on" do
expect(household_needs.depends_on).to eq([
{
"non_location_setup_questions_completed?" => true,
},
])
end
end

50
spec/models/form/lettings/subsections/household_situation_spec.rb

@ -0,0 +1,50 @@
require "rails_helper"
RSpec.describe Form::Lettings::Subsections::HouseholdSituation, type: :model do
subject(:household_situation) { described_class.new(subsection_id, subsection_definition, section) }
let(:subsection_id) { nil }
let(:subsection_definition) { nil }
let(:section) { instance_double(Form::Lettings::Sections::Household) }
it "has correct section" do
expect(household_situation.section).to eq(section)
end
it "has correct pages" do
expect(household_situation.pages.map(&:id)).to eq(
%w[time_lived_in_local_authority
time_on_waiting_list
reason_for_leaving_last_settled_home
reason_for_leaving_last_settled_home_renewal
previous_housing_situation
previous_housing_situation_renewal
homelessness
previous_postcode
previous_local_authority
reasonable_preference
reasonable_preference_reason
allocation_system
referral
referral_prp
referral_supported_housing
referral_supported_housing_prp],
)
end
it "has the correct id" do
expect(household_situation.id).to eq("household_situation")
end
it "has the correct label" do
expect(household_situation.label).to eq("Household situation")
end
it "has the correct depends_on" do
expect(household_situation.depends_on).to eq([
{
"non_location_setup_questions_completed?" => true,
},
])
end
end

53
spec/models/form/lettings/subsections/income_and_benefits_spec.rb

@ -0,0 +1,53 @@
require "rails_helper"
RSpec.describe Form::Lettings::Subsections::IncomeAndBenefits, type: :model do
subject(:income_and_benefits) { described_class.new(subsection_id, subsection_definition, section) }
let(:subsection_id) { nil }
let(:subsection_definition) { nil }
let(:section) { instance_double(Form::Lettings::Sections::RentAndCharges) }
it "has correct section" do
expect(income_and_benefits.section).to eq(section)
end
it "has correct pages" do
expect(income_and_benefits.pages.map(&:id)).to eq(
%w[income_known
income_amount
net_income_value_check
housing_benefit
benefits_proportion
rent_or_other_charges
rent_period
care_home_weekly
care_home_bi_weekly
care_home_4_weekly
care_home_monthly
rent_weekly
rent_bi_weekly
rent_4_weekly
rent_monthly
min_rent_value_check
max_rent_value_check
outstanding
outstanding_amount],
)
end
it "has the correct id" do
expect(income_and_benefits.id).to eq("income_and_benefits")
end
it "has the correct label" do
expect(income_and_benefits.label).to eq("Income, benefits and outgoings")
end
it "has the correct depends_on" do
expect(income_and_benefits.depends_on).to eq([
{
"non_location_setup_questions_completed?" => true,
},
])
end
end

51
spec/models/form/lettings/subsections/property_information_spec.rb

@ -0,0 +1,51 @@
require "rails_helper"
RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
subject(:property_information) { described_class.new(subsection_id, subsection_definition, section) }
let(:subsection_id) { nil }
let(:subsection_definition) { nil }
let(:section) { instance_double(Form::Lettings::Sections::TenancyAndProperty) }
it "has correct section" do
expect(property_information.section).to eq(section)
end
it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq(
%w[property_postcode
property_local_authority
first_time_property_let_as_social_housing
property_let_type
property_vacancy_reason_not_first_let
property_vacancy_reason_first_let
property_number_of_times_relet_not_social_let
property_number_of_times_relet_social_let
property_unit_type
property_building_type
property_wheelchair_accessible
property_number_of_bedrooms
void_or_renewal_date
void_date_value_check
new_build_handover_date
property_major_repairs
property_major_repairs_value_check],
)
end
it "has the correct id" do
expect(property_information.id).to eq("property_information")
end
it "has the correct label" do
expect(property_information.label).to eq("Property information")
end
it "has the correct depends_on" do
expect(property_information.depends_on).to eq([
{
"non_location_setup_questions_completed?" => true,
},
])
end
end

35
spec/models/form/lettings/subsections/tenancy_information_spec.rb

@ -0,0 +1,35 @@
require "rails_helper"
RSpec.describe Form::Lettings::Subsections::TenancyInformation, type: :model do
subject(:tenancy_information) { described_class.new(subsection_id, subsection_definition, section) }
let(:subsection_id) { nil }
let(:subsection_definition) { nil }
let(:section) { instance_double(Form::Lettings::Sections::TenancyAndProperty) }
it "has correct section" do
expect(tenancy_information.section).to eq(section)
end
it "has correct pages" do
expect(tenancy_information.pages.map(&:id)).to eq(
%w[joint starter_tenancy tenancy_type starter_tenancy_type tenancy_length shelteredaccom],
)
end
it "has the correct id" do
expect(tenancy_information.id).to eq("tenancy_information")
end
it "has the correct label" do
expect(tenancy_information.label).to eq("Tenancy information")
end
it "has the correct depends_on" do
expect(tenancy_information.depends_on).to eq([
{
"non_location_setup_questions_completed?" => true,
},
])
end
end
Loading…
Cancel
Save