From 21201dc875b79eb1904d5d55b08c1356b22bf183 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Thu, 22 Sep 2022 16:27:31 +0100 Subject: [PATCH] feat: update tests (and add housingneeds_type to schema that was previously missing) --- db/schema.rb | 1 + spec/factories/sales_log.rb | 1 + spec/models/form/sales/subsections/setup_spec.rb | 2 +- spec/models/form_handler_spec.rb | 4 ++-- spec/models/form_spec.rb | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 279cd7cd2..2d42a1d77 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -230,6 +230,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_09_21_154025) do t.bigint "location_id" t.integer "major_repairs_date_value_check" t.integer "void_date_value_check" + t.integer "housingneeds_type" t.integer "housingneeds_other" t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id" t.index ["location_id"], name: "index_lettings_logs_on_location_id" diff --git a/spec/factories/sales_log.rb b/spec/factories/sales_log.rb index da656367f..b36c3dc8a 100644 --- a/spec/factories/sales_log.rb +++ b/spec/factories/sales_log.rb @@ -10,6 +10,7 @@ FactoryBot.define do ownershipsch { 2 } type { 8 } saledate { Time.utc(2022, 2, 2, 10, 36, 49) } + companybuy { 1 } jointpur { 1 } end end diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb index 6b537ce04..4d06c5b6a 100644 --- a/spec/models/form/sales/subsections/setup_spec.rb +++ b/spec/models/form/sales/subsections/setup_spec.rb @@ -13,7 +13,7 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do it "has correct pages" do expect(setup.pages.map(&:id)).to eq( - %w[organisation created_by completion_date purchaser_code ownership_scheme shared_ownership_type discounted_ownership_type outright_ownership_type joint_purchase], + %w[organisation created_by completion_date purchaser_code ownership_scheme shared_ownership_type discounted_ownership_type outright_ownership_type buyer_company joint_purchase], ) end diff --git a/spec/models/form_handler_spec.rb b/spec/models/form_handler_spec.rb index 19bb10675..55d39e4e4 100644 --- a/spec/models/form_handler_spec.rb +++ b/spec/models/form_handler_spec.rb @@ -61,14 +61,14 @@ RSpec.describe FormHandler do it "is able to load a current sales form" do form = form_handler.get_form("current_sales") expect(form).to be_a(Form) - expect(form.pages.count).to eq(9) + expect(form.pages.count).to eq(10) expect(form.name).to eq("2022_2023_sales") end it "is able to load a previous sales form" do form = form_handler.get_form("previous_sales") expect(form).to be_a(Form) - expect(form.pages.count).to eq(9) + expect(form.pages.count).to eq(10) expect(form.name).to eq("2021_2022_sales") end end diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb index c9d2a3f36..c26667193 100644 --- a/spec/models/form_spec.rb +++ b/spec/models/form_spec.rb @@ -218,9 +218,9 @@ RSpec.describe Form, type: :model do expect(form.sections[0].class).to eq(Form::Sales::Sections::Setup) expect(form.subsections.count).to eq(1) expect(form.subsections.first.id).to eq("setup") - expect(form.pages.count).to eq(9) + expect(form.pages.count).to eq(10) expect(form.pages.first.id).to eq("organisation") - expect(form.questions.count).to eq(10) + expect(form.questions.count).to eq(11) expect(form.questions.first.id).to eq("owning_organisation_id") expect(form.start_date).to eq(Time.zone.parse("2022-04-01")) expect(form.end_date).to eq(Time.zone.parse("2023-07-01"))